Skip to main content

parallel_map

Function parallel_map 

Source
pub fn parallel_map<T, R, F>(
    data: &[T],
    f: F,
    n_threads: usize,
) -> CoreResult<Vec<R>>
where T: Sync + 'static, R: Send + Default + Clone + 'static, F: Fn(&T) -> R + Send + Sync + 'static,
Expand description

Apply f to every element of data in parallel, returning results in the same order as the input.

n_threads = 0 uses hardware concurrency.