remove typed stuff / just specify rsc if needed

This commit is contained in:
2026-01-03 18:06:05 -05:00
parent 59901b6580
commit f2ac6f195f
14 changed files with 126 additions and 164 deletions

View File

@@ -62,17 +62,14 @@ impl<Rsc: HasState> Tasks<Rsc> {
)
}
pub fn spawn<F: for<'a> AsyncFnOnce(&'a mut TaskCtx<Rsc>) + 'static + std::marker::Send>(
&mut self,
task: F,
) where
for<'a> <F as AsyncFnOnce<(&'a mut TaskCtx<Rsc>,)>>::CallOnceFuture: Send,
pub fn spawn<F: AsyncFnOnce(TaskCtx<Rsc>) + 'static + std::marker::Send>(&mut self, task: F)
where
F::CallOnceFuture: Send,
{
let send = self.msg_send.clone();
let window = self.window.clone();
let _ = self.start.send(Box::pin(async move {
let mut ctx = TaskCtx::new(send);
task(&mut ctx).await;
task(TaskCtx::new(send)).await;
window.request_redraw();
}));
}