Struct par_map::ParMapBuilder [−][src]
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]pub struct ParMapBuilder<I> { /* fields omitted */ }
A builder used to configure the parallele work.
This struct is created by the with_nb_threads()
method on
ParIter
. See its documentation for more.
Methods
impl<I: Iterator> ParMapBuilder<I>
[src]
impl<I: Iterator> ParMapBuilder<I>
ⓘImportant traits for Map<I, B, F>pub fn par_map<B, F>(self, f: F) -> Map<I, B, F> where
F: Sync + Send + 'static + Fn(I::Item) -> B,
B: Send + 'static,
I::Item: Send + 'static,
[src]
ⓘImportant traits for Map<I, B, F>
pub fn par_map<B, F>(self, f: F) -> Map<I, B, F> where
F: Sync + Send + 'static + Fn(I::Item) -> B,
B: Send + 'static,
I::Item: Send + 'static,
As ParMap::par_map, but with a custom number of threads
Example
use par_map::ParMap; let a = [1, 2, 3]; let mut iter = a.iter() .cloned() .with_nb_threads(2) .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);
ⓘImportant traits for FlatMap<I, U, F>pub fn par_flat_map<U, F>(self, f: F) -> FlatMap<I, U, F> where
F: Sync + Send + 'static + Fn(I::Item) -> U,
U: IntoIterator,
U::Item: Send + 'static,
I::Item: Send + 'static,
[src]
ⓘImportant traits for FlatMap<I, U, F>
pub fn par_flat_map<U, F>(self, f: F) -> FlatMap<I, U, F> where
F: Sync + Send + 'static + Fn(I::Item) -> U,
U: IntoIterator,
U::Item: Send + 'static,
I::Item: Send + 'static,
As ParMap::par_flat_map, but with a custom number of threads
Example
use par_map::ParMap; let words = ["alpha", "beta", "gamma"]; let merged: String = words.iter() .cloned() // as items must be 'static .with_nb_threads(2) .par_flat_map(|s| s.chars()) // exactly as std::iter::Iterator::flat_map .collect(); assert_eq!(merged, "alphabetagamma");
ⓘImportant traits for PackedMap<'a, B>pub fn par_packed_map<'a, B, F>(self, nb: usize, f: F) -> PackedMap<'a, B> where
F: Sync + Send + 'static + Fn(I::Item) -> B,
B: Send + 'static,
I::Item: Send + 'static,
Self: 'a,
[src]
ⓘImportant traits for PackedMap<'a, B>
pub fn par_packed_map<'a, B, F>(self, nb: usize, f: F) -> PackedMap<'a, B> where
F: Sync + Send + 'static + Fn(I::Item) -> B,
B: Send + 'static,
I::Item: Send + 'static,
Self: 'a,
As ParMap::par_packed_map, but with a custom number of threads
Example
use par_map::ParMap; let a = [1, 2, 3]; let mut iter = a.iter() .cloned() .with_nb_threads(2) .par_packed_map(2, |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);
ⓘImportant traits for PackedFlatMap<'a, T>pub fn par_packed_flat_map<'a, U, F>(
self,
nb: usize,
f: F
) -> PackedFlatMap<'a, U::Item> where
F: Sync + Send + 'static + Fn(I::Item) -> U,
U: IntoIterator + 'a,
U::Item: Send + 'static,
I::Item: Send + 'static,
Self: 'a,
[src]
ⓘImportant traits for PackedFlatMap<'a, T>
pub fn par_packed_flat_map<'a, U, F>(
self,
nb: usize,
f: F
) -> PackedFlatMap<'a, U::Item> where
F: Sync + Send + 'static + Fn(I::Item) -> U,
U: IntoIterator + 'a,
U::Item: Send + 'static,
I::Item: Send + 'static,
Self: 'a,
As ParMap::par_packed_flat_map, but with a custom number of threads
Example
use par_map::ParMap; let words = ["alpha", "beta", "gamma"]; let merged: String = words.iter() .cloned() .with_nb_threads(2) .par_packed_flat_map(2, |s| s.chars()) .collect(); assert_eq!(merged, "alphabetagamma");
Auto Trait Implementations
impl<I> Send for ParMapBuilder<I> where
I: Send,
impl<I> Send for ParMapBuilder<I> where
I: Send,
impl<I> Sync for ParMapBuilder<I> where
I: Sync,
impl<I> Sync for ParMapBuilder<I> where
I: Sync,