[][src]Struct af_lib::prelude::af_core::task::try_join::TryJoin

pub struct TryJoin<T, E> { /* fields omitted */ }

Concurrently waits for the results of multiple tasks that may return an error.

Implementations

impl<T, E> TryJoin<T, E> where
    E: From<Panic> + Send + 'static,
    T: Send + 'static, 
[src]

pub fn new() -> TryJoin<T, E>[src]

Creates an empty join.

pub fn add(&mut self, task: impl Start<Result<T, E>>) -> usize[src]

Adds a task to the join, returning its index.

pub fn add_as(
    &mut self,
    name: impl Into<SharedString>,
    task: impl Start<Result<T, E>>
) -> usize
[src]

Adds a named task to the join, returning its index.

pub async fn next(&'_ mut self) -> Option<StoppedTask<T, E>>[src]

Waits for the next stopped task.

If all tasks have stopped, this function returns None.

pub async fn try_next(
    &'_ mut self
) -> Option<Result<FinishedTask<T>, FailedTask<E>>>
[src]

Waits for the next stopped task and returns its information as a Result.

If all tasks have stopped, this function returns None.

pub async fn drain(&'_ mut self)[src]

Waits for all tasks to stop, dropping their results.

pub async fn try_drain(&'_ mut self) -> Result<(), FailedTask<E>>[src]

Waits for all tasks to stop, dropping their results, until a task fails.

Methods from Deref<Target = Join<Result<T, E>>>

pub fn add(&mut self, task: impl Start<T>) -> usize[src]

Adds a task to the join, returning its index.

pub fn add_as(
    &mut self,
    name: impl Into<SharedString>,
    task: impl Start<T>
) -> usize
[src]

Adds a named task to the join, returning its index.

pub async fn next(&'_ mut self) -> Option<StoppedTask<Result<T, Panic>>>[src]

Waits for the next stopped task.

If all tasks have stopped, this function returns None.

pub async fn try_next(
    &'_ mut self
) -> Option<Result<StoppedTask<T>, PanickedTask>>
[src]

Waits for the next stopped task and returns its information as a Result.

If all tasks have stopped, this function returns None.

pub async fn drain(&'_ mut self)[src]

Waits for all tasks to stop, dropping their results.

pub async fn try_drain(&'_ mut self) -> Result<(), PanickedTask>[src]

Waits for all tasks to stop, dropping their results, until a task panics.

Trait Implementations

impl<T, E> Default for TryJoin<T, E> where
    E: From<Panic> + Send + 'static,
    T: Send + 'static, 
[src]

impl<T, E> Deref for TryJoin<T, E>[src]

type Target = Join<Result<T, E>>

The resulting type after dereferencing.

impl<T, E> DerefMut for TryJoin<T, E>[src]

Auto Trait Implementations

impl<T, E> RefUnwindSafe for TryJoin<T, E>[src]

impl<T, E> Send for TryJoin<T, E> where
    E: Send,
    T: Send
[src]

impl<T, E> Sync for TryJoin<T, E> where
    E: Send,
    T: Send
[src]

impl<T, E> Unpin for TryJoin<T, E>[src]

impl<T, E> UnwindSafe for TryJoin<T, E>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,