Skip to main content

TryFutureConsumer

Trait TryFutureConsumer 

Source
pub trait TryFutureConsumer {
    type Ok;
    type Err;

    // Required method
    fn try_fut_consume(
        self,
        func: impl FnMut(Self::Ok) + Send,
    ) -> impl Future<Output = Result<(), Self::Err>>;
}
Expand description

Like FutureConsumer, but for fallible futures.

Spawns all futures concurrently. Calls func for each Ok value as it arrives. On the first Err, cancels remaining tasks and returns that error.

Required Associated Types§

Required Methods§

Source

fn try_fut_consume( self, func: impl FnMut(Self::Ok) + Send, ) -> impl Future<Output = Result<(), Self::Err>>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<I, Fut, T, E> TryFutureConsumer for I
where I: Iterator<Item = Fut>, Fut: Future<Output = Result<T, E>> + Send + 'static, T: Send + 'static, E: Send + 'static,

Source§

type Ok = T

Source§

type Err = E