Struct task_group::TaskGroup [−][src]
pub struct TaskGroup<E> { /* fields omitted */ }
Expand description
A TaskGroup is used to spawn a collection of tasks. The collection has two properties:
- if any task returns an error or panicks, all tasks are terminated.
- if the
TaskManager
returned byTaskGroup::new
is dropped, all tasks are terminated.
Implementations
pub async fn spawn(
&self,
name: impl AsRef<str>,
f: impl Future<Output = Result<(), E>> + Send + 'static
) -> Result<(), SpawnError>
pub async fn spawn_on(
&self,
name: impl AsRef<str>,
runtime: Handle,
f: impl Future<Output = Result<(), E>> + Send + 'static
) -> Result<(), SpawnError>
pub async fn spawn_local(
&self,
name: impl AsRef<str>,
f: impl Future<Output = Result<(), E>> + 'static
) -> Result<(), SpawnError>
Trait Implementations
Auto Trait Implementations
impl<E> !RefUnwindSafe for TaskGroup<E>
impl<E> !UnwindSafe for TaskGroup<E>
Blanket Implementations
Mutably borrows from an owned value. Read more