diff options
author | 2025-01-24 18:47:34 +0100 | |
---|---|---|
committer | 2025-01-24 18:47:34 +0100 | |
commit | 3d893ae01b64eb51b2f5854949c694090118e052 (patch) | |
tree | 9da2b03d4518fc2b17daf42f544693393c132565 /examples/toast/src/main.rs | |
parent | 3a07c631add426a308607055d1b46d934f21e7f6 (diff) | |
download | iced-3d893ae01b64eb51b2f5854949c694090118e052.tar.gz iced-3d893ae01b64eb51b2f5854949c694090118e052.tar.bz2 iced-3d893ae01b64eb51b2f5854949c694090118e052.zip |
Add `Duration` helpers to `time` module
Diffstat (limited to '')
-rw-r--r-- | examples/toast/src/main.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/examples/toast/src/main.rs b/examples/toast/src/main.rs index a1b5886f..2ae9bfe2 100644 --- a/examples/toast/src/main.rs +++ b/examples/toast/src/main.rs @@ -162,7 +162,6 @@ impl Default for App { mod toast { use std::fmt; - use std::time::{Duration, Instant}; use iced::advanced::layout::{self, Layout}; use iced::advanced::overlay; @@ -171,6 +170,7 @@ mod toast { use iced::advanced::{Clipboard, Shell, Widget}; use iced::mouse; use iced::theme; + use iced::time::{self, Duration, Instant}; use iced::widget::{ button, column, container, horizontal_rule, horizontal_space, row, text, }; @@ -502,9 +502,8 @@ mod toast { self.instants.iter_mut().enumerate().for_each( |(index, maybe_instant)| { if let Some(instant) = maybe_instant.as_mut() { - let remaining = - Duration::from_secs(self.timeout_secs) - .saturating_sub(instant.elapsed()); + let remaining = time::seconds(self.timeout_secs) + .saturating_sub(instant.elapsed()); if remaining == Duration::ZERO { maybe_instant.take(); |