summaryrefslogtreecommitdiffstats
path: root/examples/toast/src
diff options
context:
space:
mode:
authorLibravatar Héctor <hector@hecrj.dev>2025-01-24 18:59:44 +0100
committerLibravatar GitHub <noreply@github.com>2025-01-24 18:59:44 +0100
commit5eedf5798c0fcd92cfd3f304ce9454bb6c274f09 (patch)
tree0d8d28ef8c062ea1a1651b77531ed091dfe5e561 /examples/toast/src
parent654c4b37148bda655f0c6676845d2b4ead801f40 (diff)
parent3d893ae01b64eb51b2f5854949c694090118e052 (diff)
downloadiced-5eedf5798c0fcd92cfd3f304ce9454bb6c274f09.tar.gz
iced-5eedf5798c0fcd92cfd3f304ce9454bb6c274f09.tar.bz2
iced-5eedf5798c0fcd92cfd3f304ce9454bb6c274f09.zip
Merge pull request #2747 from iced-rs/time-repeat-subscription
Implement `time::repeat` and simplify `Subscription::run_with`
Diffstat (limited to 'examples/toast/src')
-rw-r--r--examples/toast/src/main.rs7
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();