ParallelIterator

Trait ParallelIterator 

Source
pub trait ParallelIterator: Sized {
    type Item;

Show 13 methods // Required methods fn for_each<F>(self, f: F) where F: FnMut(Self::Item); fn map<F, R>(self, f: F) -> Map<Self, F> where F: Fn(Self::Item) -> R; fn filter<F>(self, f: F) -> Filter<Self, F> where F: Fn(&Self::Item) -> bool; fn collect<C>(self) -> C where C: FromParallelIterator<Self::Item>; fn sum<S>(self) -> S where S: Sum<Self::Item>; fn reduce<F>(self, reduce_op: F) -> Option<Self::Item> where F: Fn(Self::Item, Self::Item) -> Self::Item; fn find_any<F>(self, predicate: F) -> Option<Self::Item> where F: Fn(&Self::Item) -> bool; fn all<F>(self, predicate: F) -> bool where F: Fn(Self::Item) -> bool; fn any<F>(self, predicate: F) -> bool where F: Fn(Self::Item) -> bool; // Provided methods fn fold<T, ID, F>(self, identity: ID, fold_op: F) -> Fold<Self, ID, F> where ID: Fn() -> T, F: Fn(T, Self::Item) -> T { ... } fn cloned<'a, T>(self) -> Cloned<Self> where Self: ParallelIterator<Item = &'a T>, T: 'a + Clone { ... } fn count<F>(self, predicate: F) -> usize where F: Fn(&Self::Item) -> bool { ... } fn partition<F>(self, predicate: F) -> (Vec<Self::Item>, Vec<Self::Item>) where F: Fn(&Self::Item) -> bool { ... }
}
Expand description

Trait for parallel iterators

Required Associated Types§

Source

type Item

The type of item being iterated

Required Methods§

Source

fn for_each<F>(self, f: F)
where F: FnMut(Self::Item),

Execute a function on each item (sequential for now)

Source

fn map<F, R>(self, f: F) -> Map<Self, F>
where F: Fn(Self::Item) -> R,

Map each item (sequential for now)

Source

fn filter<F>(self, f: F) -> Filter<Self, F>
where F: Fn(&Self::Item) -> bool,

Filter items (sequential for now)

Source

fn collect<C>(self) -> C
where C: FromParallelIterator<Self::Item>,

Collect into a collection

Source

fn sum<S>(self) -> S
where S: Sum<Self::Item>,

Sum all items

Source

fn reduce<F>(self, reduce_op: F) -> Option<Self::Item>
where F: Fn(Self::Item, Self::Item) -> Self::Item,

Reduce items with a reduction function

Source

fn find_any<F>(self, predicate: F) -> Option<Self::Item>
where F: Fn(&Self::Item) -> bool,

Find any item that matches the predicate

Source

fn all<F>(self, predicate: F) -> bool
where F: Fn(Self::Item) -> bool,

Check if all items match the predicate

Source

fn any<F>(self, predicate: F) -> bool
where F: Fn(Self::Item) -> bool,

Check if any item matches the predicate

Provided Methods§

Source

fn fold<T, ID, F>(self, identity: ID, fold_op: F) -> Fold<Self, ID, F>
where ID: Fn() -> T, F: Fn(T, Self::Item) -> T,

Fold items with an identity value and accumulator function

Source

fn cloned<'a, T>(self) -> Cloned<Self>
where Self: ParallelIterator<Item = &'a T>, T: 'a + Clone,

Clone all items (for reference iterators)

Source

fn count<F>(self, predicate: F) -> usize
where F: Fn(&Self::Item) -> bool,

Count items matching predicate

Source

fn partition<F>(self, predicate: F) -> (Vec<Self::Item>, Vec<Self::Item>)
where F: Fn(&Self::Item) -> bool,

Partition items based on predicate

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<'a, I, T> ParallelIterator for Cloned<I>
where I: ParallelIterator<Item = &'a T>, T: 'a + Clone,

Source§

type Item = T

Source§

impl<'a, T: 'a + Send> ParallelIterator for ParIterMut<'a, T>

Source§

impl<'a, T: 'a + Sync> ParallelIterator for ParIter<'a, T>

Source§

impl<I, F> ParallelIterator for Filter<I, F>
where I: ParallelIterator, F: Fn(&I::Item) -> bool,

Source§

impl<I, F, R> ParallelIterator for Map<I, F>
where I: ParallelIterator, F: Fn(I::Item) -> R,

Source§

type Item = R

Source§

impl<I, T, ID, F> ParallelIterator for Fold<I, ID, F>
where I: ParallelIterator, ID: Fn() -> T, F: Fn(T, I::Item) -> T,

Source§

type Item = T