From 928b714d14c4973a8c9467370864f8adc1c69d7c Mon Sep 17 00:00:00 2001 From: Ashley Wulber Date: Fri, 5 Jul 2024 14:08:07 -0400 Subject: [PATCH] fix: toaster behind feature gate --- iced | 2 +- src/widget/mod.rs | 3 ++- src/widget/toaster/mod.rs | 6 ++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/iced b/iced index 4c609e77..6f83a8d1 160000 --- a/iced +++ b/iced @@ -1 +1 @@ -Subproject commit 4c609e776a7721bddb6d50b60096f4d1f655491c +Subproject commit 6f83a8d16447b2590cb081f3e0f294678cc6caaf diff --git a/src/widget/mod.rs b/src/widget/mod.rs index 7f36f0c4..445ffe86 100644 --- a/src/widget/mod.rs +++ b/src/widget/mod.rs @@ -350,4 +350,5 @@ pub mod warning; #[doc(inline)] pub use warning::*; -pub mod toaster; \ No newline at end of file +#[cfg(any(feature = "winit", feature = "wayland"))] +pub mod toaster; diff --git a/src/widget/toaster/mod.rs b/src/widget/toaster/mod.rs index 4d96a838..78ab3165 100644 --- a/src/widget/toaster/mod.rs +++ b/src/widget/toaster/mod.rs @@ -144,10 +144,7 @@ pub struct ToastMessage(u32); impl Toasts { /// Add a new [`Toast`] - pub fn push( - &mut self, - mut toast: Toast, - ) -> Command + pub fn push(&mut self, mut toast: Toast) -> Command where Message: From, { @@ -164,6 +161,7 @@ impl Toasts { self.toasts.push_back(toast); crate::command::future(async move { + #[cfg(feature = "tokio")] tokio::time::sleep(duration).await; crate::app::Message::App(Message::from(message)) })