Skip to content

Commit

Permalink
Merge pull request #153 from DioxusLabs/jk/spawn-future
Browse files Browse the repository at this point in the history
feat: add "spawn" method for futures
  • Loading branch information
jkelleyrtp authored Jan 24, 2022
2 parents 508f7e9 + bad4b77 commit 732ec01
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/core/src/scopes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 732ec01

Please sign in to comment.