Add Duration helpers to time module

This commit is contained in:
Héctor Ramón Jiménez 2025-01-24 18:47:34 +01:00
parent 3a07c631ad
commit 3d893ae01b
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
8 changed files with 40 additions and 19 deletions

View file

@ -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)
}
};