pub struct Join<T> { /* private fields */ }Expand description
Concurrently waits for the results of multiple tasks.
Implementations§
Source§impl<T> Join<T>where
T: Send + 'static,
impl<T> Join<T>where
T: Send + 'static,
Sourcepub fn add(&mut self, task: impl Start<T>) -> Index
pub fn add(&mut self, task: impl Start<T>) -> Index
Adds a task to the join, returning its index.
Sourcepub fn add_as(
&mut self,
name: impl Into<SharedString>,
task: impl Start<T>,
) -> Index
pub fn add_as( &mut self, name: impl Into<SharedString>, task: impl Start<T>, ) -> Index
Adds a named task to the join, returning its index.
Sourcepub async fn next(&mut self) -> Option<StoppedTask<Result<T, Panic>>>
pub async fn next(&mut self) -> Option<StoppedTask<Result<T, Panic>>>
Waits for the next stopped task.
If all tasks have stopped, this function returns None.
Sourcepub async fn try_next(&mut self) -> Option<Result<StoppedTask<T>, PanickedTask>>
pub async fn try_next(&mut self) -> Option<Result<StoppedTask<T>, PanickedTask>>
Waits for the next stopped task and returns its information as a
Result.
If all tasks have stopped, this function returns None.
Sourcepub async fn try_drain(&mut self) -> Result<(), PanickedTask>
pub async fn try_drain(&mut self) -> Result<(), PanickedTask>
Waits for all tasks to stop, dropping their results, until a task panics.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Join<T>
impl<T> RefUnwindSafe for Join<T>
impl<T> Send for Join<T>where
T: Send,
impl<T> Sync for Join<T>where
T: Send,
impl<T> Unpin for Join<T>
impl<T> UnwindSafe for Join<T>
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