DEV Community

Sean Atukorala
Sean Atukorala

Posted on

Solution for "error[E0425]: cannot find function `every` in module `time`" when using Iced Rust GUI library

Figure 1: Winter Scenery

Problem:
Running into the following error when trying to use the Iced GUI library for a Rust program that replicates the stopwatch Iced GUI example:

$ cargo build
error[E0425]: cannot find function `every` in module `time`
   --> src\main.rs:203:23
    |
203 |                 time::every(Duration::from_millis(10)).map(Message::Tick)
    |                       ^^^^^ not found in `time`
Enter fullscreen mode Exit fullscreen mode

Solution:
The problem was that the smol feature was not included in the features option for the iced dependency listed in the Cargo.toml file.

Try replacing your existing iced dependency line with the following line:

# Cargo.toml file

[dependencies]
iced = {version = "0.6", features = ["smol"]}
Enter fullscreen mode Exit fullscreen mode

Then run cargo build and see if the error is resolved!

Conclusion

Thanks for reading this blog post!

If you have any questions or concerns please feel free to post a comment in this post and I will get back to you if I find the time.

If you found this article helpful please share it and make sure to follow me on Twitter and GitHub, connect with me on LinkedIn and subscribe to my YouTube channel.

Top comments (0)