Merge pull request #153 from DioxusLabs/jk/spawn-future

feat: add "spawn" method for futures
This commit is contained in:
Jonathan Kelley authored and GitHub committed 2022-01-24 15:22:42 -05:00
commit 732ec018c3
1 file changed
+5
+5
View File
@@ -751,6 +751,11 @@ impl ScopeState {
self.tasks.push_fut(fut)
}
/// Spawns the future but does not return the TaskId
pub fn spawn(&self, fut: impl Future<Output = ()> + 'static) {
self.push_future(fut);
}
// todo: attach some state to the future to know if we should poll it
pub fn remove_future(&self, id: TaskId) {
self.tasks.remove_fut(id);