Struct rayon::par_iter::map::Map
[−]
[src]
pub struct Map<M, MAP_OP> { /* fields omitted */ }
////////////////////////////////////////////////////////////////////////
Methods
impl<M, MAP_OP> Map<M, MAP_OP>
[src]
Trait Implementations
impl<M, MAP_OP> ParallelIterator for Map<M, MAP_OP> where M: ParallelIterator,
MAP_OP: MapOp<M::Item>
[src]
MAP_OP: MapOp<M::Item>
type Item = MAP_OP::Output
fn drive_unindexed<C>(self, consumer: C) -> C::Result where C: UnindexedConsumer<Self::Item>
fn opt_len(&mut self) -> Option<usize>
fn weight(self, scale: f64) -> Weight<Self>
Indicates the relative "weight" of producing each item in this parallel iterator. A higher weight will cause finer-grained parallel subtasks. 1.0 indicates something very cheap and uniform, like copying a value out of an array, or computing x + 1
. If your tasks are either very expensive, or very unpredictable, you are better off with higher values. See also weight_max
, which is a convenient shorthand to force the finest grained parallel execution posible. Tuning this value should not affect correctness but can improve (or hurt) performance. Read more
fn weight_max(self) -> Weight<Self>
Shorthand for self.weight(f64::INFINITY)
. This forces the smallest granularity of parallel execution, which makes sense when your parallel tasks are (potentially) very expensive to execute. Read more
fn for_each<OP>(self, op: OP) where OP: Fn(Self::Item) + Sync
Executes OP
on each item produced by the iterator, in parallel.
fn count(self) -> usize
Counts the number of items in this parallel iterator.
fn map<MAP_OP, R>(self, map_op: MAP_OP) -> Map<Self, MapFn<MAP_OP>> where MAP_OP: Fn(Self::Item) -> R + Sync
Applies map_op
to each item of this iterator, producing a new iterator with the results. Read more
fn cloned<'a, T>(self) -> Map<Self, MapCloned> where T: 'a + Clone, Self: ParallelIterator<Item=&'a T>
Creates an iterator which clones all of its elements. This may be useful when you have an iterator over &T
, but you need T
. Read more
fn inspect<INSPECT_OP>(self,
inspect_op: INSPECT_OP)
-> Map<Self, MapInspect<INSPECT_OP>> where INSPECT_OP: Fn(&Self::Item) + Sync
inspect_op: INSPECT_OP)
-> Map<Self, MapInspect<INSPECT_OP>> where INSPECT_OP: Fn(&Self::Item) + Sync
Applies inspect_op
to a reference to each item of this iterator, producing a new iterator passing through the original items. This is often useful for debugging to see what's happening in iterator stages. Read more
fn filter<FILTER_OP>(self, filter_op: FILTER_OP) -> Filter<Self, FILTER_OP> where FILTER_OP: Fn(&Self::Item) -> bool + Sync
Applies filter_op
to each item of this iterator, producing a new iterator with only the items that gave true
results. Read more
fn filter_map<FILTER_OP, R>(self,
filter_op: FILTER_OP)
-> FilterMap<Self, FILTER_OP> where FILTER_OP: Fn(Self::Item) -> Option<R> + Sync
filter_op: FILTER_OP)
-> FilterMap<Self, FILTER_OP> where FILTER_OP: Fn(Self::Item) -> Option<R> + Sync
Applies filter_op
to each item of this iterator to get an Option
, producing a new iterator with only the items from Some
results. Read more
fn flat_map<MAP_OP, PI>(self, map_op: MAP_OP) -> FlatMap<Self, MAP_OP> where MAP_OP: Fn(Self::Item) -> PI + Sync, PI: IntoParallelIterator
Applies map_op
to each item of this iterator to get nested iterators, producing a new iterator that flattens these back into one. Read more
fn reduce<OP, IDENTITY>(self, identity: IDENTITY, op: OP) -> Self::Item where OP: Fn(Self::Item, Self::Item) -> Self::Item + Sync,
IDENTITY: Fn() -> Self::Item + Sync
IDENTITY: Fn() -> Self::Item + Sync
Reduces the items in the iterator into one item using op
. The argument identity
should be a closure that can produce "identity" value which may be inserted into the sequence as needed to create opportunities for parallel execution. So, for example, if you are doing a summation, then identity()
ought to produce something that represents the zero for your type (but consider just calling sum()
in that case). Read more
fn reduce_with<OP>(self, op: OP) -> Option<Self::Item> where OP: Fn(Self::Item, Self::Item) -> Self::Item + Sync
Reduces the items in the iterator into one item using op
. If the iterator is empty, None
is returned; otherwise, Some
is returned. Read more
fn reduce_with_identity<OP>(self, identity: Self::Item, op: OP) -> Self::Item where OP: Fn(Self::Item, Self::Item) -> Self::Item + Sync,
Self::Item: Clone + Sync
Self::Item: Clone + Sync
: call reduce
instead
Deprecated. Use reduce()
instead.
fn fold<IDENTITY_ITEM, IDENTITY, FOLD_OP>(self,
identity: IDENTITY,
fold_op: FOLD_OP)
-> Fold<Self, IDENTITY, FOLD_OP> where FOLD_OP: Fn(IDENTITY_ITEM, Self::Item) -> IDENTITY_ITEM + Sync,
IDENTITY: Fn() -> IDENTITY_ITEM + Sync,
IDENTITY_ITEM: Send
identity: IDENTITY,
fold_op: FOLD_OP)
-> Fold<Self, IDENTITY, FOLD_OP> where FOLD_OP: Fn(IDENTITY_ITEM, Self::Item) -> IDENTITY_ITEM + Sync,
IDENTITY: Fn() -> IDENTITY_ITEM + Sync,
IDENTITY_ITEM: Send
Parallel fold is similar to sequential fold except that the sequence of items may be subdivided before it is folded. Consider a list of numbers like 22 3 77 89 46
. If you used sequential fold to add them (fold(0, |a,b| a+b)
, you would wind up first adding 0 + 22, then 22 + 3, then 25 + 77, and so forth. The parallel fold works similarly except that it first breaks up your list into sublists, and hence instead of yielding up a single sum at the end, it yields up multiple sums. The number of results is nondeterministic, as is the point where the breaks occur. Read more
fn sum(self) -> Self::Item where SumOp: ReduceOp<Self::Item>
Sums up the items in the iterator. Read more
fn product(self) -> Self::Item where ProductOp: ReduceOp<Self::Item>
Multiplies all the items in the iterator. Read more
fn mul(self) -> Self::Item where ProductOp: ReduceOp<Self::Item>
: name changed to product()
to match sequential iterators
DEPRECATED
fn min(self) -> Option<Self::Item> where Self::Item: Ord
Computes the minimum of all the items in the iterator. If the iterator is empty, None
is returned; otherwise, Some(min)
is returned. Read more
fn min_by_key<K, F>(self, f: F) -> Option<Self::Item> where K: Ord + Send, F: Sync + Fn(&Self::Item) -> K
Computes the item that yields the minimum value for the given function. If the iterator is empty, None
is returned; otherwise, Some(item)
is returned. Read more
fn max(self) -> Option<Self::Item> where Self::Item: Ord
Computes the maximum of all the items in the iterator. If the iterator is empty, None
is returned; otherwise, Some(max)
is returned. Read more
fn max_by_key<K, F>(self, f: F) -> Option<Self::Item> where K: Ord + Send, F: Sync + Fn(&Self::Item) -> K
Computes the item that yields the maximum value for the given function. If the iterator is empty, None
is returned; otherwise, Some(item)
is returned. Read more
fn chain<CHAIN>(self, chain: CHAIN) -> ChainIter<Self, CHAIN::Iter> where CHAIN: IntoParallelIterator<Item=Self::Item>
Takes two iterators and creates a new iterator over both.
fn find_any<FIND_OP>(self, predicate: FIND_OP) -> Option<Self::Item> where FIND_OP: Fn(&Self::Item) -> bool + Sync
Searches for some item in the parallel iterator that matches the given predicate and returns it. This operation is similar to [find
on sequential iterators][find] but the item returned may not be the first one in the parallel sequence which matches, since we search the entire sequence in parallel. Read more
fn any<ANY_OP>(self, predicate: ANY_OP) -> bool where ANY_OP: Fn(Self::Item) -> bool + Sync
Searches for some item in the parallel iterator that matches the given predicate, and if so returns true. Once a match is found, we'll attempt to stop process the rest of the items. Proving that there's no match, returning false, does require visiting every item. Read more
fn all<ALL_OP>(self, predicate: ALL_OP) -> bool where ALL_OP: Fn(Self::Item) -> bool + Sync
Tests that every item in the parallel iterator matches the given predicate, and if so returns true. If a counter-example is found, we'll attempt to stop processing more items, then return false. Read more
fn collect<C>(self) -> C where C: FromParallelIterator<Self::Item>
Create a fresh collection containing all the element produced by this parallel iterator. Read more
impl<M, MAP_OP> BoundedParallelIterator for Map<M, MAP_OP> where M: BoundedParallelIterator,
MAP_OP: MapOp<M::Item>
[src]
MAP_OP: MapOp<M::Item>
fn upper_bound(&mut self) -> usize
fn drive<C>(self, consumer: C) -> C::Result where C: Consumer<Self::Item>
impl<M, MAP_OP> ExactParallelIterator for Map<M, MAP_OP> where M: ExactParallelIterator,
MAP_OP: MapOp<M::Item>
[src]
MAP_OP: MapOp<M::Item>
fn len(&mut self) -> usize
Produces an exact count of how many items this iterator will produce, presuming no panic occurs. Read more
fn collect_into(self, target: &mut Vec<Self::Item>)
Collects the results of the iterator into the specified vector. The vector is always truncated before execution begins. If possible, reusing the vector across calls can lead to better performance since it reuses the same backing buffer. Read more
impl<M, MAP_OP> IndexedParallelIterator for Map<M, MAP_OP> where M: IndexedParallelIterator,
MAP_OP: MapOp<M::Item>
[src]
MAP_OP: MapOp<M::Item>
fn with_producer<CB>(self, callback: CB) -> CB::Output where CB: ProducerCallback<Self::Item>
fn zip<ZIP_OP>(self, zip_op: ZIP_OP) -> ZipIter<Self, ZIP_OP::Iter> where ZIP_OP: IntoParallelIterator, ZIP_OP::Iter: IndexedParallelIterator
Iterate over tuples (A, B)
, where the items A
are from this iterator and B
are from the iterator given as argument. Like the zip
method on ordinary iterators, if the two iterators are of unequal length, you only get the items they have in common. Read more
fn cmp<I>(self, other: I) -> Ordering where I: IntoParallelIterator<Item=Self::Item>,
I::Iter: IndexedParallelIterator,
Self::Item: Ord
I::Iter: IndexedParallelIterator,
Self::Item: Ord
Lexicographically compares the elements of this ParallelIterator
with those of another. Read more
fn partial_cmp<I>(self, other: I) -> Option<Ordering> where I: IntoParallelIterator,
I::Iter: IndexedParallelIterator,
Self::Item: PartialOrd<I::Item>
I::Iter: IndexedParallelIterator,
Self::Item: PartialOrd<I::Item>
Lexicographically compares the elements of this ParallelIterator
with those of another. Read more
fn eq<I>(self, other: I) -> bool where I: IntoParallelIterator,
I::Iter: IndexedParallelIterator,
Self::Item: PartialEq<I::Item>
I::Iter: IndexedParallelIterator,
Self::Item: PartialEq<I::Item>
Determines if the elements of this ParallelIterator
are equal to those of another Read more
fn ne<I>(self, other: I) -> bool where I: IntoParallelIterator,
I::Iter: IndexedParallelIterator,
Self::Item: PartialEq<I::Item>
I::Iter: IndexedParallelIterator,
Self::Item: PartialEq<I::Item>
Determines if the elements of this ParallelIterator
are unequal to those of another Read more
fn lt<I>(self, other: I) -> bool where I: IntoParallelIterator,
I::Iter: IndexedParallelIterator,
Self::Item: PartialOrd<I::Item>
I::Iter: IndexedParallelIterator,
Self::Item: PartialOrd<I::Item>
Determines if the elements of this ParallelIterator
are lexicographically less than those of another. Read more
fn le<I>(self, other: I) -> bool where I: IntoParallelIterator,
I::Iter: IndexedParallelIterator,
Self::Item: PartialOrd<I::Item>
I::Iter: IndexedParallelIterator,
Self::Item: PartialOrd<I::Item>
Determines if the elements of this ParallelIterator
are less or equal to those of another. Read more
fn gt<I>(self, other: I) -> bool where I: IntoParallelIterator,
I::Iter: IndexedParallelIterator,
Self::Item: PartialOrd<I::Item>
I::Iter: IndexedParallelIterator,
Self::Item: PartialOrd<I::Item>
Determines if the elements of this ParallelIterator
are lexicographically greater than those of another. Read more
fn ge<I>(self, other: I) -> bool where I: IntoParallelIterator,
I::Iter: IndexedParallelIterator,
Self::Item: PartialOrd<I::Item>
I::Iter: IndexedParallelIterator,
Self::Item: PartialOrd<I::Item>
Determines if the elements of this ParallelIterator
are less or equal to those of another. Read more
fn enumerate(self) -> Enumerate<Self>
Yields an index along with each item.
fn skip(self, n: usize) -> Skip<Self>
Creates an iterator that skips the first n
elements.
fn take(self, n: usize) -> Take<Self>
Creates an iterator that yields the first n
elements.
fn position_any<POSITION_OP>(self, predicate: POSITION_OP) -> Option<usize> where POSITION_OP: Fn(Self::Item) -> bool + Sync
Searches for some item in the parallel iterator that matches the given predicate, and returns its index. Like ParallelIterator::find_any
, the parallel search will not necessarily find the first match, and once a match is found we'll attempt to stop processing any more. Read more