Struct task_group::TaskGroup
source · [−]pub struct TaskGroup<E> { /* private fields */ }
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
sourceimpl<E: Send + 'static> TaskGroup<E>
impl<E: Send + 'static> TaskGroup<E>
pub fn new() -> (Self, TaskManager<E>)
pub fn spawn(
&self,
name: impl AsRef<str>,
f: impl Future<Output = Result<(), E>> + Send + 'static
) -> impl Future<Output = Result<(), SpawnError>> + '_
pub fn spawn_on(
&self,
name: impl AsRef<str>,
runtime: Handle,
f: impl Future<Output = Result<(), E>> + Send + 'static
) -> impl Future<Output = Result<(), SpawnError>> + '_
pub fn spawn_local(
&self,
name: impl AsRef<str>,
f: impl Future<Output = Result<(), E>> + 'static
) -> impl Future<Output = Result<(), SpawnError>> + '_
Trait Implementations
Auto Trait Implementations
impl<E> !RefUnwindSafe for TaskGroup<E>
impl<E> Send for TaskGroup<E> where
E: Send,
impl<E> Sync for TaskGroup<E> where
E: Send,
impl<E> Unpin for TaskGroup<E>
impl<E> !UnwindSafe for TaskGroup<E>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more