feat: impl setup restoration
This commit is contained in:
1
src/util/mod.rs
Normal file
1
src/util/mod.rs
Normal file
@@ -0,0 +1 @@
|
||||
pub(crate) mod timeout;
|
||||
13
src/util/timeout.rs
Normal file
13
src/util/timeout.rs
Normal file
@@ -0,0 +1,13 @@
|
||||
pub(crate) fn set_timeout<E>(
|
||||
f: impl FnOnce(gpui::WeakEntity<E>, &mut gpui::AsyncApp) + Send + 'static,
|
||||
duration: std::time::Duration,
|
||||
cx: &mut gpui::Context<E>,
|
||||
) where
|
||||
E: 'static,
|
||||
{
|
||||
cx.spawn(async move |weak, cx| {
|
||||
gpui::Timer::after(duration).await;
|
||||
f(weak, cx);
|
||||
})
|
||||
.detach();
|
||||
}
|
||||
Reference in New Issue
Block a user