ComputePoolExt

Trait ComputePoolExt 

Source
pub trait ComputePoolExt {
    // Required methods
    fn parallel_batch<'life0, 'async_trait, T, F, R>(
        &'life0 self,
        items: Vec<T>,
        batch_size: usize,
        f: F,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<R>>> + Send + 'async_trait>>
       where T: Send + Sync + 'static + 'async_trait,
             F: Fn(&[T]) -> Vec<R> + Send + Sync + 'static + 'async_trait,
             R: Send + 'static + 'async_trait,
             Self: 'async_trait,
             'life0: 'async_trait;
    fn parallel_map<'life0, 'async_trait, T, F, R>(
        &'life0 self,
        items: Vec<T>,
        f: F,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<R>>> + Send + 'async_trait>>
       where T: Send + Sync + 'static + 'async_trait,
             F: Fn(T) -> R + Send + Sync + 'static + 'async_trait,
             R: Send + 'static + 'async_trait,
             Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Extension trait for ComputePool with additional patterns

Required Methods§

Source

fn parallel_batch<'life0, 'async_trait, T, F, R>( &'life0 self, items: Vec<T>, batch_size: usize, f: F, ) -> Pin<Box<dyn Future<Output = Result<Vec<R>>> + Send + 'async_trait>>
where T: Send + Sync + 'static + 'async_trait, F: Fn(&[T]) -> Vec<R> + Send + Sync + 'static + 'async_trait, R: Send + 'static + 'async_trait, Self: 'async_trait, 'life0: 'async_trait,

Process items in parallel batches

Source

fn parallel_map<'life0, 'async_trait, T, F, R>( &'life0 self, items: Vec<T>, f: F, ) -> Pin<Box<dyn Future<Output = Result<Vec<R>>> + Send + 'async_trait>>
where T: Send + Sync + 'static + 'async_trait, F: Fn(T) -> R + Send + Sync + 'static + 'async_trait, R: Send + 'static + 'async_trait, Self: 'async_trait, 'life0: 'async_trait,

Map over items in parallel using Rayon’s par_iter

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§