Getting started with 'iced' GUI library for Rust

Getting started with 'iced' GUI library for Rust

Being new to Rust, I'm starting with various simple examples to understand some of the dynamics.

Upon initial searches, I found the following references:

Getting Started

At the time of this blog, the iced help documentation is lacking. There are numerous examples, but failed to immediately build and the missing dependency wasn't obvious.
# create the project
cargo new hellorusticed
cd hellorusticed
code .

# add dependencies
cargo add iced
cargo add iced_lazy
cargo add iced_native

Example 1 - Slider

Here is one example that worked right out of the box.

  1. Copy main.rs contents from the following link into the new project (https://github.com/iced-rs/iced/blob/0.9/examples/slider/src/main.rs)

  2. Build via cargo build.

💡
I was a little confused why two windows were coming up at first. I'm assuming that the Sandbox implementation makes this happen, but not sure. I modified the application to use a println! when an update event occurred on an event.

The following screenshots were taken from the build output with a slightly hacked update function for test purposes.

Example 2 - Download Progress

Here is the second, slightly more comprehensive application that downloads a speed test file.

https://github.com/iced-rs/iced/tree/0.9/examples/download_progress

I re-used the last example mostly... actions included the following, although unsure if they were needed.

  1. purge target directory

  2. deleted Cargo.lock.

  3. modified Cargo.toml directly to remove unneeded dependencies.

# dependencies
cargo add iced --features tokio
cargo add iced_native
cargo add iced_futures
cargo add reqwest --no-default-features --features rustls-tls

# build
cargo build

Conclusion

It feels like there is some potential here, but not ready for prime time. I struggled to get some of the examples to work, including the seemingly simple modal dialog example. I'll keep my eyes on this one.

source: https://github.com/ericjameszimmerman/rustbasics