pub struct AsyncGroup<'a> { /* private fields */ }
Expand description
The structure that allows for the asynchronous execution of multiple functions and waits for all of them to complete.
Functions are added using the add
method and are then run concurrently.
The AsyncGroup
ensures that all tasks finish before proceeding,
optionally collecting any errors that occur.
Implementations§
Source§impl<'a> AsyncGroup<'_>
impl<'a> AsyncGroup<'_>
Sourcepub fn add<F, Fut>(&mut self, future_fn: F)
pub fn add<F, Fut>(&mut self, future_fn: F)
Adds an asynchronous function (a future-producing closure) to the group.
The provided function will be executed asynchronously when join_and_put_errors_into
or join_and_ignore_errors
is called.
§Type Parameters
F
: The type of the closure, which must beFnOnce
andSend + 'static
.Fut
: The type of the future returned by the closure, which must beFuture<Output = Result<(), Err>> + Send + 'static
.
§Parameters
future_fn
: A closure that, when called, returns a future to be executed.
Auto Trait Implementations§
impl<'a> Freeze for AsyncGroup<'a>
impl<'a> !RefUnwindSafe for AsyncGroup<'a>
impl<'a> Send for AsyncGroup<'a>
impl<'a> !Sync for AsyncGroup<'a>
impl<'a> Unpin for AsyncGroup<'a>
impl<'a> !UnwindSafe for AsyncGroup<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more