Expand description
Parallel by-reference functor mapping.
User story: “I want to map over a collection by reference in parallel.”
This trait combines the by-reference access of RefFunctor with
the parallelism of ParFunctor. The closure receives &A
(no consumption of elements) and must be Send + Sync. Elements must be Send + Sync
for rayon’s par_iter().
§Examples
use fp_library::{
brands::VecBrand,
classes::par_ref_functor::ParRefFunctor,
};
let v = vec![1, 2, 3];
let result = VecBrand::par_ref_map(|x: &i32| x.to_string(), &v);
assert_eq!(result, vec!["1", "2", "3"]);Traits§
- ParRef
Functor - Parallel by-reference functor mapping.
Functions§
- par_
ref_ map - Maps a function over a structure by reference in parallel.