Skip to main content

FutureConsumer

Trait FutureConsumer 

Source
pub trait FutureConsumer {
    type Item;

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

Tools for consume iterator which return future.

Required Associated Types§

Required Methods§

Source

fn fut_consume( self, func: impl FnMut(Self::Item) + Send, ) -> impl Future<Output = ()>

Use to immediately consume the data produced by the future in the iterator without waiting for all the data to be processed. The closures runs in the current thread.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<I, Fut> FutureConsumer for I
where I: Iterator<Item = Fut>, Fut: Future + Send + 'static, Fut::Output: Send,

Source§

type Item = <Fut as Future>::Output