summaryrefslogtreecommitdiffstats
path: root/examples/stopwatch
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2025-01-24 18:47:34 +0100
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2025-01-24 18:47:34 +0100
commit3d893ae01b64eb51b2f5854949c694090118e052 (patch)
tree9da2b03d4518fc2b17daf42f544693393c132565 /examples/stopwatch
parent3a07c631add426a308607055d1b46d934f21e7f6 (diff)
downloadiced-3d893ae01b64eb51b2f5854949c694090118e052.tar.gz
iced-3d893ae01b64eb51b2f5854949c694090118e052.tar.bz2
iced-3d893ae01b64eb51b2f5854949c694090118e052.zip
Add `Duration` helpers to `time` module
Diffstat (limited to 'examples/stopwatch')
-rw-r--r--examples/stopwatch/src/main.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/examples/stopwatch/src/main.rs b/examples/stopwatch/src/main.rs
index 0d824d36..a814da55 100644
--- a/examples/stopwatch/src/main.rs
+++ b/examples/stopwatch/src/main.rs
@@ -1,10 +1,8 @@
use iced::keyboard;
-use iced::time;
+use iced::time::{self, milliseconds, Duration, Instant};
use iced::widget::{button, center, column, row, text};
use iced::{Center, Element, Subscription, Theme};
-use std::time::{Duration, Instant};
-
pub fn main() -> iced::Result {
iced::application("Stopwatch - Iced", Stopwatch::update, Stopwatch::view)
.subscription(Stopwatch::subscription)
@@ -63,7 +61,7 @@ impl Stopwatch {
let tick = match self.state {
State::Idle => Subscription::none(),
State::Ticking { .. } => {
- time::every(Duration::from_millis(10)).map(Message::Tick)
+ time::every(milliseconds(10)).map(Message::Tick)
}
};