pub enum CondIterator<P, S>where
    P: ParallelIterator,
    S: Iterator<Item = P::Item>,{
    Parallel(P),
    Serial(S),
}
Expand description

An iterator that could be parallel or serial, with a common API either way.

The available methods mostly follow ParallelIterator and IndexedParallelIterator, as rayon has the stricter requirements, and they are parallelized with rayon::iter types. Serial implementations use appropriate types from std::iter and itertools::structs.

Variants§

§

Parallel(P)

§

Serial(S)

Implementations§

source§

impl<P, S> CondIterator<P, S>where P: ParallelIterator, S: Iterator<Item = P::Item>,

source

pub fn new<I>(iterable: I, parallel: bool) -> Selfwhere I: IntoParallelIterator<Iter = P, Item = P::Item> + IntoIterator<IntoIter = S, Item = S::Item>,

source

pub fn from_parallel<I>(iterable: I) -> Selfwhere I: IntoParallelIterator<Iter = P, Item = P::Item>,

source

pub fn from_serial<I>(iterable: I) -> Selfwhere I: IntoIterator<IntoIter = S, Item = S::Item>,

source

pub fn is_parallel(&self) -> bool

source

pub fn is_serial(&self) -> bool

source§

impl<P, S> CondIterator<P, S>where P: ParallelIterator, S: Iterator<Item = P::Item> + Send,

source

pub fn into_parallel(self) -> Either<P, IterBridge<S>>

source§

impl<P, S> CondIterator<P, S>where P: ParallelIterator, S: Iterator<Item = P::Item>,

source

pub fn for_each<OP>(self, op: OP)where OP: Fn(P::Item) + Sync + Send,

source

pub fn for_each_with<OP, T>(self, init: T, op: OP)where OP: Fn(&mut T, P::Item) + Sync + Send, T: Send + Clone,

source

pub fn for_each_init<OP, INIT, T>(self, init: INIT, op: OP)where OP: Fn(&mut T, P::Item) + Sync + Send, INIT: Fn() -> T + Sync + Send,

source

pub fn count(self) -> usize

source

pub fn map<F, R>(self, map_op: F) -> CondIterator<Map<P, F>, Map<S, F>>where F: Fn(P::Item) -> R + Sync + Send, R: Send,

source

pub fn map_with<F, T, R>( self, init: T, map_op: F ) -> CondIterator<MapWith<P, T, F>, Map<S, impl FnMut(P::Item) -> R>>where F: Fn(&mut T, P::Item) -> R + Sync + Send, T: Send + Clone, R: Send,

source

pub fn map_init<F, INIT, T, R>( self, init: INIT, map_op: F ) -> CondIterator<MapInit<P, INIT, F>, Map<S, impl FnMut(P::Item) -> R>>where F: Fn(&mut T, P::Item) -> R + Sync + Send, INIT: Fn() -> T + Sync + Send, R: Send,

source

pub fn cloned<'a, T>(self) -> CondIterator<Cloned<P>, Cloned<S>>where T: 'a + Clone + Sync + Send, P: ParallelIterator<Item = &'a T>, S: Iterator<Item = &'a T>,

source

pub fn copied<'a, T>(self) -> CondIterator<Copied<P>, Copied<S>>where T: 'a + Copy + Sync + Send, P: ParallelIterator<Item = &'a T>, S: Iterator<Item = &'a T>,

source

pub fn inspect<OP>( self, inspect_op: OP ) -> CondIterator<Inspect<P, OP>, Inspect<S, OP>>where OP: Fn(&P::Item) + Sync + Send,

source

pub fn update<OP>( self, update_op: OP ) -> CondIterator<Update<P, OP>, Update<S, OP>>where OP: Fn(&mut P::Item) + Sync + Send,

source

pub fn filter<Pred>( self, filter_op: Pred ) -> CondIterator<Filter<P, Pred>, Filter<S, Pred>>where Pred: Fn(&P::Item) -> bool + Sync + Send,

source

pub fn filter_map<Pred, R>( self, filter_op: Pred ) -> CondIterator<FilterMap<P, Pred>, FilterMap<S, Pred>>where Pred: Fn(P::Item) -> Option<R> + Sync + Send, R: Send,

source

pub fn flat_map<F, I>( self, map_op: F ) -> CondIterator<FlatMap<P, F>, FlatMap<S, I, F>>where F: Fn(P::Item) -> I + Sync + Send, I: IntoParallelIterator + IntoIterator<Item = <I as IntoParallelIterator>::Item>,

source

pub fn flat_map_iter<F, I>( self, map_op: F ) -> CondIterator<FlatMapIter<P, F>, FlatMap<S, I, F>>where F: Fn(P::Item) -> I + Sync + Send, I: IntoIterator, I::Item: Send,

source

pub fn flatten(self) -> CondIterator<Flatten<P>, Flatten<S>>where P::Item: IntoParallelIterator, S::Item: IntoIterator<Item = <P::Item as IntoParallelIterator>::Item>,

source

pub fn flatten_iter(self) -> CondIterator<FlattenIter<P>, Flatten<S>>where P::Item: IntoIterator, <P::Item as IntoIterator>::Item: Send,

source

pub fn reduce<OP, ID>(self, identity: ID, op: OP) -> P::Itemwhere OP: Fn(P::Item, P::Item) -> P::Item + Sync + Send, ID: Fn() -> P::Item + Sync + Send,

source

pub fn reduce_with<OP>(self, op: OP) -> Option<P::Item>where OP: Fn(P::Item, P::Item) -> P::Item + Sync + Send,

source

pub fn fold<T, ID, F>( self, identity: ID, fold_op: F ) -> CondIterator<Fold<P, ID, F>, Once<T>>where F: Fn(T, P::Item) -> T + Sync + Send, ID: Fn() -> T + Sync + Send, T: Send,

source

pub fn fold_with<F, T>( self, init: T, fold_op: F ) -> CondIterator<FoldWith<P, T, F>, Once<T>>where F: Fn(T, P::Item) -> T + Sync + Send, T: Send + Clone,

source

pub fn sum<Sum>(self) -> Sumwhere Sum: Send + Sum<P::Item> + Sum<Sum>,

source

pub fn product<Product>(self) -> Productwhere Product: Send + Product<P::Item> + Product<Product>,

source

pub fn min(self) -> Option<P::Item>where P::Item: Ord,

source

pub fn min_by<F>(self, f: F) -> Option<P::Item>where F: Sync + Send + Fn(&P::Item, &P::Item) -> Ordering,

source

pub fn min_by_key<K, F>(self, f: F) -> Option<P::Item>where K: Ord + Send, F: Sync + Send + Fn(&P::Item) -> K,

source

pub fn max(self) -> Option<P::Item>where P::Item: Ord,

source

pub fn max_by<F>(self, f: F) -> Option<P::Item>where F: Sync + Send + Fn(&P::Item, &P::Item) -> Ordering,

source

pub fn max_by_key<K, F>(self, f: F) -> Option<P::Item>where K: Ord + Send, F: Sync + Send + Fn(&P::Item) -> K,

source

pub fn chain<C>( self, chain: C ) -> CondIterator<Chain<P, C::Iter>, Chain<S, C::IntoIter>>where C: IntoParallelIterator<Item = P::Item> + IntoIterator<Item = P::Item>,

source

pub fn find_any<Pred>(self, predicate: Pred) -> Option<P::Item>where Pred: Fn(&P::Item) -> bool + Sync + Send,

source

pub fn find_first<Pred>(self, predicate: Pred) -> Option<P::Item>where Pred: Fn(&P::Item) -> bool + Sync + Send,

source

pub fn any<Pred>(self, predicate: Pred) -> boolwhere Pred: Fn(P::Item) -> bool + Sync + Send,

source

pub fn all<Pred>(self, predicate: Pred) -> boolwhere Pred: Fn(P::Item) -> bool + Sync + Send,

source

pub fn while_some<T>(self) -> CondIterator<WhileSome<P>, WhileSome<S>>where P: ParallelIterator<Item = Option<T>>, S: Iterator<Item = Option<T>>, T: Send,

source

pub fn collect<C>(self) -> Cwhere C: FromCondIterator<P::Item>,

source

pub fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where P: ParallelIterator<Item = (A, B)>, S: Iterator<Item = (A, B)>, FromA: Default + Send + CondExtend<A>, FromB: Default + Send + CondExtend<B>, A: Send, B: Send,

source

pub fn partition<A, B, Pred>(self, predicate: Pred) -> (A, B)where A: Default + Send + CondExtend<P::Item>, B: Default + Send + CondExtend<P::Item>, Pred: Fn(&P::Item) -> bool + Sync + Send,

source

pub fn partition_map<A, B, Pred, L, R>(self, predicate: Pred) -> (A, B)where A: Default + Send + CondExtend<L>, B: Default + Send + CondExtend<R>, Pred: Fn(P::Item) -> Either<L, R> + Sync + Send, L: Send, R: Send,

source

pub fn intersperse( self, element: P::Item ) -> CondIterator<Intersperse<P>, Intersperse<S>>where P::Item: Clone,

source

pub fn opt_len(&self) -> Option<usize>

source§

impl<P, S> CondIterator<P, S>where P: ParallelIterator, S: DoubleEndedIterator<Item = P::Item>,

source

pub fn find_last<Pred>(self, predicate: Pred) -> Option<P::Item>where Pred: Fn(&P::Item) -> bool + Sync + Send,

source§

impl<P, S> CondIterator<P, S>where P: IndexedParallelIterator, S: Iterator<Item = P::Item>,

source

pub fn collect_into_vec(self, target: &mut Vec<P::Item>)

source

pub fn unzip_into_vecs<A, B>(self, left: &mut Vec<A>, right: &mut Vec<B>)where P: IndexedParallelIterator<Item = (A, B)>, S: Iterator<Item = (A, B)>, A: Send, B: Send,

source

pub fn zip<Z>( self, other: Z ) -> CondIterator<Zip<P, Z::Iter>, Zip<S, Z::IntoIter>>where Z: IntoParallelIterator + IntoIterator<Item = <Z as IntoParallelIterator>::Item>, Z::Iter: IndexedParallelIterator,

source

pub fn zip_eq<Z>( self, other: Z ) -> CondIterator<ZipEq<P, Z::Iter>, ZipEq<S, Z::IntoIter>>where Z: IntoParallelIterator + IntoIterator<Item = <Z as IntoParallelIterator>::Item>, Z::Iter: IndexedParallelIterator,

source

pub fn interleave<I>( self, other: I ) -> CondIterator<Interleave<P, I::Iter>, Interleave<S, I::IntoIter>>where I: IntoParallelIterator<Item = P::Item> + IntoIterator<Item = S::Item>, I::Iter: IndexedParallelIterator<Item = P::Item>,

source

pub fn interleave_shortest<I>( self, other: I ) -> CondIterator<InterleaveShortest<P, I::Iter>, InterleaveShortest<S, I::IntoIter>>where I: IntoParallelIterator<Item = P::Item> + IntoIterator<Item = S::Item>, I::Iter: IndexedParallelIterator<Item = P::Item>,

source

pub fn cmp<I>(self, other: I) -> Orderingwhere I: IntoParallelIterator<Item = P::Item> + IntoIterator<Item = S::Item>, I::Iter: IndexedParallelIterator, P::Item: Ord,

source

pub fn partial_cmp<I>(self, other: I) -> Option<Ordering>where I: IntoParallelIterator + IntoIterator<Item = <I as IntoParallelIterator>::Item>, I::Iter: IndexedParallelIterator, P::Item: PartialOrd<<I as IntoParallelIterator>::Item>,

source

pub fn eq<I>(self, other: I) -> boolwhere I: IntoParallelIterator + IntoIterator<Item = <I as IntoParallelIterator>::Item>, I::Iter: IndexedParallelIterator, P::Item: PartialEq<<I as IntoParallelIterator>::Item>,

source

pub fn ne<I>(self, other: I) -> boolwhere I: IntoParallelIterator + IntoIterator<Item = <I as IntoParallelIterator>::Item>, I::Iter: IndexedParallelIterator, P::Item: PartialEq<<I as IntoParallelIterator>::Item>,

source

pub fn lt<I>(self, other: I) -> boolwhere I: IntoParallelIterator + IntoIterator<Item = <I as IntoParallelIterator>::Item>, I::Iter: IndexedParallelIterator, P::Item: PartialOrd<<I as IntoParallelIterator>::Item>,

source

pub fn le<I>(self, other: I) -> boolwhere I: IntoParallelIterator + IntoIterator<Item = <I as IntoParallelIterator>::Item>, I::Iter: IndexedParallelIterator, P::Item: PartialOrd<<I as IntoParallelIterator>::Item>,

source

pub fn gt<I>(self, other: I) -> boolwhere I: IntoParallelIterator + IntoIterator<Item = <I as IntoParallelIterator>::Item>, I::Iter: IndexedParallelIterator, P::Item: PartialOrd<<I as IntoParallelIterator>::Item>,

source

pub fn ge<I>(self, other: I) -> boolwhere I: IntoParallelIterator + IntoIterator<Item = <I as IntoParallelIterator>::Item>, I::Iter: IndexedParallelIterator, P::Item: PartialOrd<<I as IntoParallelIterator>::Item>,

source

pub fn enumerate(self) -> CondIterator<Enumerate<P>, Enumerate<S>>

source

pub fn skip(self, n: usize) -> CondIterator<Skip<P>, Skip<S>>

source

pub fn take(self, n: usize) -> CondIterator<Take<P>, Take<S>>

source

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

source

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

source

pub fn positions<Pred>( self, predicate: Pred ) -> CondIterator<Positions<P, Pred>, Positions<S, Pred>>where Pred: Fn(P::Item) -> bool + Sync + Send,

source

pub fn step_by(self, step: usize) -> CondIterator<StepBy<P>, StepBy<S>>

source§

impl<P, S> CondIterator<P, S>where P: IndexedParallelIterator, S: DoubleEndedIterator<Item = P::Item>,

source

pub fn rev(self) -> CondIterator<Rev<P>, Rev<S>>

source§

impl<P, S> CondIterator<P, S>where P: IndexedParallelIterator, S: ExactSizeIterator<Item = P::Item>,

source

pub fn len(&self) -> usize

source§

impl<P, S> CondIterator<P, S>where P: IndexedParallelIterator, S: ExactSizeIterator + DoubleEndedIterator<Item = P::Item>,

source

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

Auto Trait Implementations§

§

impl<P, S> RefUnwindSafe for CondIterator<P, S>where P: RefUnwindSafe, S: RefUnwindSafe,

§

impl<P, S> Send for CondIterator<P, S>where S: Send,

§

impl<P, S> Sync for CondIterator<P, S>where P: Sync, S: Sync,

§

impl<P, S> Unpin for CondIterator<P, S>where P: Unpin, S: Unpin,

§

impl<P, S> UnwindSafe for CondIterator<P, S>where P: UnwindSafe, S: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.