Skip to main content

AsyncParallelIterator

Trait AsyncParallelIterator 

Source
pub trait AsyncParallelIterator: AsyncIterator {
    // Provided methods
    fn par_map<F, Fut, R>(
        self,
        concurrency: usize,
        map_fn: F,
    ) -> ParAsyncMap<Self, F>
       where Self: Sized,
             F: Fn(Self::Item) -> Fut + Send + Sync,
             Fut: Future<Output = R> + Send,
             R: Send { ... }
    fn par_filter<F, Fut>(
        self,
        concurrency: usize,
        filter_fn: F,
    ) -> ParAsyncFilter<Self, F>
       where Self: Sized,
             F: Fn(&Self::Item) -> Fut + Send + Sync,
             Fut: Future<Output = bool> + Send { ... }
    fn par_for_each<F, Fut>(
        self,
        concurrency: usize,
        func: F,
    ) -> impl Future<Output = ()> + Send
       where Self: Sized,
             F: Fn(Self::Item) -> Fut + Send + Sync,
             Fut: Future<Output = ()> + Send { ... }
}
Expand description

Parallel async iterator for CPU+async hybrid workloads

Provided Methods§

Source

fn par_map<F, Fut, R>( self, concurrency: usize, map_fn: F, ) -> ParAsyncMap<Self, F>
where Self: Sized, F: Fn(Self::Item) -> Fut + Send + Sync, Fut: Future<Output = R> + Send, R: Send,

Execute async operations in parallel with controlled concurrency

Source

fn par_filter<F, Fut>( self, concurrency: usize, filter_fn: F, ) -> ParAsyncFilter<Self, F>
where Self: Sized, F: Fn(&Self::Item) -> Fut + Send + Sync, Fut: Future<Output = bool> + Send,

Parallel async filter with concurrency control

Source

fn par_for_each<F, Fut>( self, concurrency: usize, func: F, ) -> impl Future<Output = ()> + Send
where Self: Sized, F: Fn(Self::Item) -> Fut + Send + Sync, Fut: Future<Output = ()> + Send,

Execute side effects in parallel with async operations.

Returns a real Future driven by the caller’s runtime; unlike a blocking consumer it never blocks the async executor.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§