diff --git a/Cargo.lock b/Cargo.lock index e1cd57e6..0142993c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2462,7 +2462,6 @@ dependencies = [ "iced_debug", "iced_program", "iced_widget", - "smol", ] [[package]] diff --git a/devtools/Cargo.toml b/devtools/Cargo.toml index 927398bf..df7e5012 100644 --- a/devtools/Cargo.toml +++ b/devtools/Cargo.toml @@ -17,6 +17,3 @@ workspace = true iced_program.workspace = true iced_widget.workspace = true iced_debug.workspace = true - -# TODO: Use program executor? -smol.workspace = true diff --git a/devtools/src/lib.rs b/devtools/src/lib.rs index cec392ff..19540c87 100644 --- a/devtools/src/lib.rs +++ b/devtools/src/lib.rs @@ -12,11 +12,13 @@ use crate::core::theme::{self, Base, Theme}; use crate::core::time::seconds; use crate::core::window; use crate::futures::Subscription; +use crate::futures::futures::channel::oneshot; use crate::program::Program; use crate::runtime::Task; use crate::widget::{bottom_right, container, stack, text, themer}; use std::fmt; +use std::thread; pub fn attach(program: impl Program + 'static) -> impl Program { struct Attach

{ @@ -113,9 +115,19 @@ where state, show_notification: true, }, - Task::perform(smol::Timer::after(seconds(2)), |_| { - Message::HideNotification - }), + Task::perform( + async move { + let (sender, receiver) = oneshot::channel(); + + let _ = thread::spawn(|| { + thread::sleep(seconds(2)); + let _ = sender.send(()); + }); + + let _ = receiver.await; + }, + |_| Message::HideNotification, + ), ) }