[][src]Trait rayon::iter::IndexedParallelIterator

pub trait IndexedParallelIterator: ParallelIterator {
    fn len(&mut self) -> usize;
fn drive<'c, C: Consumer<Self::Item>>(self, consumer: C) -> C::Result;
fn with_producer<CB: ProducerCallback<Self::Item>>(
        self,
        callback: CB
    ) -> CB::Output; fn collect_into(self, target: &mut Vec<Self::Item>) { ... }
fn unzip_into<A, B>(self, left: &mut Vec<A>, right: &mut Vec<B>)
    where
        Self: IndexedParallelIterator<Item = (A, B)>,
        A: Send,
        B: Send
, { ... }
fn zip<Z>(self, zip_op: Z) -> Zip<Self, Z::Iter>
    where
        Z: IntoParallelIterator,
        Z::Iter: IndexedParallelIterator
, { ... }
fn cmp<I>(self, other: I) -> Ordering
    where
        I: IntoParallelIterator<Item = Self::Item>,
        I::Iter: IndexedParallelIterator,
        Self::Item: Ord
, { ... }
fn partial_cmp<I>(self, other: I) -> Option<Ordering>
    where
        I: IntoParallelIterator,
        I::Iter: IndexedParallelIterator,
        Self::Item: PartialOrd<I::Item>
, { ... }
fn eq<I>(self, other: I) -> bool
    where
        I: IntoParallelIterator,
        I::Iter: IndexedParallelIterator,
        Self::Item: PartialEq<I::Item>
, { ... }
fn ne<I>(self, other: I) -> bool
    where
        I: IntoParallelIterator,
        I::Iter: IndexedParallelIterator,
        Self::Item: PartialEq<I::Item>
, { ... }
fn lt<I>(self, other: I) -> bool
    where
        I: IntoParallelIterator,
        I::Iter: IndexedParallelIterator,
        Self::Item: PartialOrd<I::Item>
, { ... }
fn le<I>(self, other: I) -> bool
    where
        I: IntoParallelIterator,
        I::Iter: IndexedParallelIterator,
        Self::Item: PartialOrd<I::Item>
, { ... }
fn gt<I>(self, other: I) -> bool
    where
        I: IntoParallelIterator,
        I::Iter: IndexedParallelIterator,
        Self::Item: PartialOrd<I::Item>
, { ... }
fn ge<I>(self, other: I) -> bool
    where
        I: IntoParallelIterator,
        I::Iter: IndexedParallelIterator,
        Self::Item: PartialOrd<I::Item>
, { ... }
fn enumerate(self) -> Enumerate<Self> { ... }
fn skip(self, n: usize) -> Skip<Self> { ... }
fn take(self, n: usize) -> Take<Self> { ... }
fn position_any<P>(self, predicate: P) -> Option<usize>
    where
        P: Fn(Self::Item) -> bool + Sync + Send
, { ... }
fn position_first<P>(self, predicate: P) -> Option<usize>
    where
        P: Fn(Self::Item) -> bool + Sync + Send
, { ... }
fn position_last<P>(self, predicate: P) -> Option<usize>
    where
        P: Fn(Self::Item) -> bool + Sync + Send
, { ... }
fn rev(self) -> Rev<Self> { ... }
fn with_min_len(self, min: usize) -> MinLen<Self> { ... }
fn with_max_len(self, max: usize) -> MaxLen<Self> { ... } }

An iterator that supports "random access" to its data, meaning that you can split it at arbitrary indices and draw data from those points.

Required methods

fn len(&mut self) -> usize

Produces an exact count of how many items this iterator will produce, presuming no panic occurs.

fn drive<'c, C: Consumer<Self::Item>>(self, consumer: C) -> C::Result

Internal method used to define the behavior of this parallel iterator. You should not need to call this directly.

This method causes the iterator self to start producing items and to feed them to the consumer consumer one by one. It may split the consumer before doing so to create the opportunity to produce in parallel. If a split does happen, it will inform the consumer of the index where the split should occur (unlike ParallelIterator::drive_unindexed()).

See the README for more details on the internals of parallel iterators.

fn with_producer<CB: ProducerCallback<Self::Item>>(
    self,
    callback: CB
) -> CB::Output

Internal method used to define the behavior of this parallel iterator. You should not need to call this directly.

This method converts the iterator into a producer P and then invokes callback.callback() with P. Note that the type of this producer is not defined as part of the API, since callback must be defined generically for all producers. This allows the producer type to contain references; it also means that parallel iterators can adjust that type without causing a breaking change.

See the README for more details on the internals of parallel iterators.

Loading content...

Provided methods

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.

fn unzip_into<A, B>(self, left: &mut Vec<A>, right: &mut Vec<B>) where
    Self: IndexedParallelIterator<Item = (A, B)>,
    A: Send,
    B: Send

Unzips the results of the iterator into the specified vectors. The vectors are always truncated before execution begins. If possible, reusing the vectors across calls can lead to better performance since they reuse the same backing buffer.

fn zip<Z>(self, zip_op: Z) -> Zip<Self, Z::Iter> where
    Z: IntoParallelIterator,
    Z::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.

fn cmp<I>(self, other: I) -> Ordering where
    I: IntoParallelIterator<Item = Self::Item>,
    I::Iter: IndexedParallelIterator,
    Self::Item: Ord

Lexicographically compares the elements of this ParallelIterator with those of another.

fn partial_cmp<I>(self, other: I) -> Option<Ordering> where
    I: IntoParallelIterator,
    I::Iter: IndexedParallelIterator,
    Self::Item: PartialOrd<I::Item>, 

Lexicographically compares the elements of this ParallelIterator with those of another.

fn eq<I>(self, other: I) -> bool where
    I: IntoParallelIterator,
    I::Iter: IndexedParallelIterator,
    Self::Item: PartialEq<I::Item>, 

Determines if the elements of this ParallelIterator are equal to those of another

fn ne<I>(self, other: I) -> bool where
    I: IntoParallelIterator,
    I::Iter: IndexedParallelIterator,
    Self::Item: PartialEq<I::Item>, 

Determines if the elements of this ParallelIterator are unequal to those of another

fn lt<I>(self, other: I) -> bool where
    I: IntoParallelIterator,
    I::Iter: IndexedParallelIterator,
    Self::Item: PartialOrd<I::Item>, 

Determines if the elements of this ParallelIterator are lexicographically less than those of another.

fn le<I>(self, other: I) -> bool where
    I: IntoParallelIterator,
    I::Iter: IndexedParallelIterator,
    Self::Item: PartialOrd<I::Item>, 

Determines if the elements of this ParallelIterator are less or equal to those of another.

fn gt<I>(self, other: I) -> bool where
    I: IntoParallelIterator,
    I::Iter: IndexedParallelIterator,
    Self::Item: PartialOrd<I::Item>, 

Determines if the elements of this ParallelIterator are lexicographically greater than those of another.

fn ge<I>(self, other: I) -> bool where
    I: IntoParallelIterator,
    I::Iter: IndexedParallelIterator,
    Self::Item: PartialOrd<I::Item>, 

Determines if the elements of this ParallelIterator are less or equal to those of another.

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<P>(self, predicate: P) -> Option<usize> where
    P: Fn(Self::Item) -> bool + Sync + Send

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.

fn position_first<P>(self, predicate: P) -> Option<usize> where
    P: Fn(Self::Item) -> bool + Sync + Send

Searches for the sequentially first item in the parallel iterator that matches the given predicate, and returns its index.

Like ParallelIterator::find_first, once a match is found, all attempts to the right of the match will be stopped, while attempts to the left must continue in case an earlier match is found.

Note that not all parallel iterators have a useful order, much like sequential HashMap iteration, so "first" may be nebulous. If you just want the first match that discovered anywhere in the iterator, position_any is a better choice.

fn position_last<P>(self, predicate: P) -> Option<usize> where
    P: Fn(Self::Item) -> bool + Sync + Send

Searches for the sequentially last item in the parallel iterator that matches the given predicate, and returns its index.

Like ParallelIterator::find_last, once a match is found, all attempts to the left of the match will be stopped, while attempts to the right must continue in case a later match is found.

Note that not all parallel iterators have a useful order, much like sequential HashMap iteration, so "last" may be nebulous. When the order doesn't actually matter to you, position_any is a better choice.

fn rev(self) -> Rev<Self>

Produces a new iterator with the elements of this iterator in reverse order.

fn with_min_len(self, min: usize) -> MinLen<Self>

Sets the minimum length of iterators desired to process in each thread. Rayon will not split any smaller than this length, but of course an iterator could already be smaller to begin with.

fn with_max_len(self, max: usize) -> MaxLen<Self>

Sets the maximum length of iterators desired to process in each thread. Rayon will try to split at least below this length, unless that would put it below the length from with_min_len(). For example, given min=10 and max=15, a length of 16 will not be split any further.

Loading content...

Implementors

impl IndexedParallelIterator for rayon::range::Iter<i16>[src]

impl IndexedParallelIterator for rayon::range::Iter<i32>[src]

impl IndexedParallelIterator for rayon::range::Iter<i8>[src]

impl IndexedParallelIterator for rayon::range::Iter<isize>[src]

impl IndexedParallelIterator for rayon::range::Iter<u16>[src]

impl IndexedParallelIterator for rayon::range::Iter<u32>[src]

impl IndexedParallelIterator for rayon::range::Iter<u8>[src]

impl IndexedParallelIterator for rayon::range::Iter<usize>[src]

impl<'a, T, I> IndexedParallelIterator for Cloned<I> where
    I: IndexedParallelIterator<Item = &'a T>,
    T: 'a + Clone + Send + Sync
[src]

impl<'a, T: Ord + Sync + 'a> IndexedParallelIterator for rayon::collections::binary_heap::Iter<'a, T>[src]

impl<'a, T: Send + 'a> IndexedParallelIterator for rayon::collections::vec_deque::IterMut<'a, T>[src]

impl<'a, T: Send + 'a> IndexedParallelIterator for rayon::option::IterMut<'a, T>[src]

impl<'a, T: Send + 'a> IndexedParallelIterator for rayon::result::IterMut<'a, T>[src]

impl<'a, T: Sync + 'a> IndexedParallelIterator for rayon::collections::vec_deque::Iter<'a, T>[src]

impl<'a, T: Sync + 'a> IndexedParallelIterator for rayon::option::Iter<'a, T>[src]

impl<'a, T: Sync + 'a> IndexedParallelIterator for rayon::result::Iter<'a, T>[src]

impl<'data, T: Send + 'data> IndexedParallelIterator for ChunksMut<'data, T>[src]

impl<'data, T: Send + 'data> IndexedParallelIterator for rayon::slice::IterMut<'data, T>[src]

impl<'data, T: Sync + 'data> IndexedParallelIterator for Chunks<'data, T>[src]

impl<'data, T: Sync + 'data> IndexedParallelIterator for rayon::slice::Iter<'data, T>[src]

impl<'data, T: Sync + 'data> IndexedParallelIterator for Windows<'data, T>[src]

impl<A, B> IndexedParallelIterator for Chain<A, B> where
    A: IndexedParallelIterator,
    B: IndexedParallelIterator<Item = A::Item>, 
[src]

impl<A, B> IndexedParallelIterator for Zip<A, B> where
    A: IndexedParallelIterator,
    B: IndexedParallelIterator
[src]

impl<I> IndexedParallelIterator for Enumerate<I> where
    I: IndexedParallelIterator
[src]

impl<I> IndexedParallelIterator for MaxLen<I> where
    I: IndexedParallelIterator
[src]

impl<I> IndexedParallelIterator for MinLen<I> where
    I: IndexedParallelIterator
[src]

impl<I> IndexedParallelIterator for Rev<I> where
    I: IndexedParallelIterator
[src]

impl<I> IndexedParallelIterator for Skip<I> where
    I: IndexedParallelIterator
[src]

impl<I> IndexedParallelIterator for Take<I> where
    I: IndexedParallelIterator
[src]

impl<I, F> IndexedParallelIterator for Inspect<I, F> where
    I: IndexedParallelIterator,
    F: Fn(&I::Item) + Sync + Send
[src]

impl<I, F, R> IndexedParallelIterator for Map<I, F> where
    I: IndexedParallelIterator,
    F: Fn(I::Item) -> R + Sync + Send,
    R: Send
[src]

impl<I, T, F, R> IndexedParallelIterator for MapWith<I, T, F> where
    I: IndexedParallelIterator,
    T: Send + Clone,
    F: Fn(&mut T, I::Item) -> R + Sync + Send,
    R: Send
[src]

impl<T: Ord + Send> IndexedParallelIterator for rayon::collections::binary_heap::IntoIter<T>[src]

impl<T: Send> IndexedParallelIterator for rayon::collections::vec_deque::IntoIter<T>[src]

impl<T: Send> IndexedParallelIterator for rayon::option::IntoIter<T>[src]

impl<T: Send> IndexedParallelIterator for rayon::result::IntoIter<T>[src]

impl<T: Send> IndexedParallelIterator for rayon::vec::IntoIter<T>[src]

Loading content...