Sfoglia il codice sorgente

feat: add "spawn" method

Jonathan Kelley 3 anni fa
parent
commit
bad4b77
1 ha cambiato i file con 5 aggiunte e 0 eliminazioni
  1. 5 0
      packages/core/src/scopes.rs

+ 5 - 0
packages/core/src/scopes.rs

@@ -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);