pub struct TaskSet { /* private fields */ }Expand description
A set of detached tasks whose end can be awaited (the liveness-count law).
Cloning shares the set: a task spawned through any clone is counted by all of them.
Implementations§
Source§impl TaskSet
impl TaskSet
Sourcepub fn spawn<F>(&self, task: F) -> Result<Joined<F::Output>, Unscheduled<F>>
pub fn spawn<F>(&self, task: F) -> Result<Joined<F::Output>, Unscheduled<F>>
Run task detached on the current executor as a member of this set.
Post: Ok means the executor owns task, which is live in the set until it ends, and
the Joined resolves to its output, or to Abandoned if it is dropped first.
Err hands task back unpolled because no executor is current, and the set is
unchanged.
Sourcepub fn spawn_with<F>(&self, spawner: &Spawner, task: F) -> Joined<F::Output> ⓘ
pub fn spawn_with<F>(&self, spawner: &Spawner, task: F) -> Joined<F::Output> ⓘ
Run task detached on spawner’s executor as a member of this set: Self::spawn
for a caller that acquired the executor before claiming anything for the task.
Post: as for Self::spawn’s Ok; if the executor has shut down, task is dropped
unpolled, leaves the set at once, and its Joined is Abandoned.