This commit is contained in:
2026-01-22 23:33:46 -05:00
parent a592318a6f
commit 17c436d944

View File

@@ -57,6 +57,13 @@ widget_trait! {
pub trait HasTasks: Sized + HasState + HasEvents { pub trait HasTasks: Sized + HasState + HasEvents {
fn tasks_mut(&mut self) -> &mut Tasks<Self>; fn tasks_mut(&mut self) -> &mut Tasks<Self>;
fn spawn_task<F: AsyncFnOnce(TaskCtx<Self>) + 'static + std::marker::Send>(&mut self, task: F)
where
F::CallOnceFuture: Send,
{
self.tasks_mut().spawn(task);
}
} }
pub trait AsyncWidgetEventFn<Rsc: HasEvents, W: ?Sized>: pub trait AsyncWidgetEventFn<Rsc: HasEvents, W: ?Sized>: