Skip to main content

Module par_filterable

Module par_filterable 

Source
Expand description

Data structures that can be filtered and filter-mapped in parallel.

§Examples

use fp_library::{
	brands::*,
	functions::*,
};

let v = vec![1, 2, 3, 4, 5];
let result: Vec<i32> =
	par_filter_map::<VecBrand, _, _>(|x: i32| if x % 2 == 0 { Some(x * 10) } else { None }, v);
assert_eq!(result, vec![20, 40]);

Traits§

ParFilterable
A type class for data structures that can be filtered and filter-mapped in parallel.

Functions§

par_filter
Filters a data structure in parallel, retaining only elements satisfying f.
par_filter_map
Maps and filters a data structure in parallel, discarding elements for which f returns None.