Skip to main content

DistributedSliceExt

Trait DistributedSliceExt 

Source
pub trait DistributedSliceExt<T> {
    // Required method
    fn distributed_process<R, F>(
        &self,
        process_fn: F,
        chunk_size: usize,
        n_workers: usize,
    ) -> Vec<R>
       where T: Send + Sync + Clone + 'static,
             R: Send + 'static,
             F: Fn(&[T]) -> Vec<R> + Send + Clone + 'static;
}
Expand description

Extension trait that adds distributed-aware parallel processing to slices.

Required Methods§

Source

fn distributed_process<R, F>( &self, process_fn: F, chunk_size: usize, n_workers: usize, ) -> Vec<R>
where T: Send + Sync + Clone + 'static, R: Send + 'static, F: Fn(&[T]) -> Vec<R> + Send + Clone + 'static,

Divide the slice into chunks, process each chunk in parallel, and concatenate the results in input order.

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.

Implementations on Foreign Types§

Source§

impl<T: Send + Sync + Clone + 'static> DistributedSliceExt<T> for [T]

Source§

fn distributed_process<R, F>( &self, process_fn: F, chunk_size: usize, n_workers: usize, ) -> Vec<R>
where R: Send + 'static, F: Fn(&[T]) -> Vec<R> + Send + Clone + 'static,

Implementors§