Trait par_map::ParMap
[−]
[src]
pub trait ParMap: Iterator + Sized { fn par_map<B, F>(self, f: F) -> Map<Self, B, F>
where
F: Sync + Send + 'static + Fn(Self::Item) -> B,
B: Send + 'static,
Self::Item: Send + 'static, { ... } fn par_flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
where
F: Sync + Send + 'static + Fn(Self::Item) -> U,
U: IntoIterator,
U::Item: Send + 'static,
Self::Item: Send + 'static, { ... } }
Provided Methods
fn par_map<B, F>(self, f: F) -> Map<Self, B, F> where
F: Sync + Send + 'static + Fn(Self::Item) -> B,
B: Send + 'static,
Self::Item: Send + 'static,
F: Sync + Send + 'static + Fn(Self::Item) -> B,
B: Send + 'static,
Self::Item: Send + 'static,
use par_map::ParMap; let a = [1, 2, 3]; let mut iter = a.iter().cloned().par_map(|x| 2 * x); assert_eq!(iter.next(), Some(2)); assert_eq!(iter.next(), Some(4)); assert_eq!(iter.next(), Some(6)); assert_eq!(iter.next(), None);
fn par_flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F> where
F: Sync + Send + 'static + Fn(Self::Item) -> U,
U: IntoIterator,
U::Item: Send + 'static,
Self::Item: Send + 'static,
F: Sync + Send + 'static + Fn(Self::Item) -> U,
U: IntoIterator,
U::Item: Send + 'static,
Self::Item: Send + 'static,
use par_map::ParMap; let words = ["alpha", "beta", "gamma"]; let merged: String = words.iter() .cloned() // as items must be 'static .par_flat_map(|s| s.chars()) // exactly as std::iter::Iterator::flat_map .collect(); assert_eq!(merged, "alphabetagamma");
Implementors
impl<I: Iterator> ParMap for I