iced-rs / iced

A cross-platform GUI library for Rust, inspired by Elm
https://iced.rs
MIT License
24.93k stars 1.18k forks source link

"download_progress" example can't be compiled in version 0.2.0 #641

Closed ghost closed 4 years ago

ghost commented 4 years ago

Hi! This is the first issue for me in this repository and thank you for making great GUI library.

I noticed when I change from iced = { path = "../..", features = ["tokio_old"] } to iced = { version="0.2.0", features = ["tokio_old"] } in Cargo.toml the below error is happened.

$ cargo build
   Compiling download_progress v0.1.0 (/Hobby/iced/examples/download_progress)
error[E0277]: the trait bound `Download: iced_futures::subscription::Recipe<iced_native::hasher::Hasher, (iced_native::event::Event, iced_native::event::Status)>` is not satisfied
 --> examples/download_progress/src/download.rs:5:37
  |
5 |       iced::Subscription::from_recipe(Download {
  |  _____________________________________^
6 | |         url: url.to_string(),
7 | |     })
  | |_____^ the trait `iced_futures::subscription::Recipe<iced_native::hasher::Hasher, (iced_native::event::Event, iced_native::event::Status)>` is not implemented for `Download`
  |
  = note: required by `iced_futures::subscription::Subscription::<H, E, O>::from_recipe`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0277`.
error: could not compile `download_progress`

To learn more, run the command again with --verbose.

When I use master branch which is same with 0.2.0 and using path = "../.."., the problem doesn't happen and it runs. I also encountered this problem in my app. Crates io requests version numbers in Cargo.toml, so I would like to change to iced = { version="0.2.0", features = ["tokio_old"] } .

Maybe changes for Recipe makes this issue, but I can't understand why this happen because I'm just a beginner.

What makes this problem? How should I do to use subscription and from_recipe function in "0.2.0"?

hecrj commented 4 years ago

You need to change the iced_native and iced_futures dependencies in the Cargo.toml to the latest crates.io version too.

ghost commented 4 years ago

Thanks! I confirmed it.