Enum rayon_cond::CondIterator
source · 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§
Implementations§
source§impl<P, S> CondIterator<P, S>where
P: ParallelIterator,
S: Iterator<Item = P::Item>,
impl<P, S> CondIterator<P, S>where P: ParallelIterator, S: Iterator<Item = P::Item>,
pub fn new<I>(iterable: I, parallel: bool) -> Selfwhere I: IntoParallelIterator<Iter = P, Item = P::Item> + IntoIterator<IntoIter = S, Item = S::Item>,
pub fn from_parallel<I>(iterable: I) -> Selfwhere I: IntoParallelIterator<Iter = P, Item = P::Item>,
pub fn from_serial<I>(iterable: I) -> Selfwhere I: IntoIterator<IntoIter = S, Item = S::Item>,
pub fn is_parallel(&self) -> bool
pub fn is_serial(&self) -> bool
source§impl<P, S> CondIterator<P, S>where
P: ParallelIterator,
S: Iterator<Item = P::Item> + Send,
impl<P, S> CondIterator<P, S>where P: ParallelIterator, S: Iterator<Item = P::Item> + Send,
pub fn into_parallel(self) -> Either<P, IterBridge<S>>
source§impl<P, S> CondIterator<P, S>where
P: ParallelIterator,
S: Iterator<Item = P::Item>,
impl<P, S> CondIterator<P, S>where P: ParallelIterator, S: Iterator<Item = P::Item>,
pub fn for_each<OP>(self, op: OP)where OP: Fn(P::Item) + Sync + Send,
pub fn for_each_with<OP, T>(self, init: T, op: OP)where OP: Fn(&mut T, P::Item) + Sync + Send, T: Send + Clone,
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,
pub fn count(self) -> usize
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,
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,
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,
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>,
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>,
pub fn inspect<OP>( self, inspect_op: OP ) -> CondIterator<Inspect<P, OP>, Inspect<S, OP>>where OP: Fn(&P::Item) + Sync + Send,
pub fn update<OP>( self, update_op: OP ) -> CondIterator<Update<P, OP>, Update<S, OP>>where OP: Fn(&mut P::Item) + Sync + Send,
pub fn filter<Pred>( self, filter_op: Pred ) -> CondIterator<Filter<P, Pred>, Filter<S, Pred>>where Pred: Fn(&P::Item) -> bool + Sync + Send,
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,
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>,
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,
pub fn flatten(self) -> CondIterator<Flatten<P>, Flatten<S>>where P::Item: IntoParallelIterator, S::Item: IntoIterator<Item = <P::Item as IntoParallelIterator>::Item>,
pub fn flatten_iter(self) -> CondIterator<FlattenIter<P>, Flatten<S>>where P::Item: IntoIterator, <P::Item as IntoIterator>::Item: Send,
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,
pub fn reduce_with<OP>(self, op: OP) -> Option<P::Item>where OP: Fn(P::Item, P::Item) -> P::Item + Sync + Send,
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,
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,
pub fn sum<Sum>(self) -> Sumwhere Sum: Send + Sum<P::Item> + Sum<Sum>,
pub fn product<Product>(self) -> Productwhere Product: Send + Product<P::Item> + Product<Product>,
pub fn min(self) -> Option<P::Item>where P::Item: Ord,
pub fn min_by<F>(self, f: F) -> Option<P::Item>where F: Sync + Send + Fn(&P::Item, &P::Item) -> Ordering,
pub fn min_by_key<K, F>(self, f: F) -> Option<P::Item>where K: Ord + Send, F: Sync + Send + Fn(&P::Item) -> K,
pub fn max(self) -> Option<P::Item>where P::Item: Ord,
pub fn max_by<F>(self, f: F) -> Option<P::Item>where F: Sync + Send + Fn(&P::Item, &P::Item) -> Ordering,
pub fn max_by_key<K, F>(self, f: F) -> Option<P::Item>where K: Ord + Send, F: Sync + Send + Fn(&P::Item) -> K,
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>,
pub fn find_any<Pred>(self, predicate: Pred) -> Option<P::Item>where Pred: Fn(&P::Item) -> bool + Sync + Send,
pub fn find_first<Pred>(self, predicate: Pred) -> Option<P::Item>where Pred: Fn(&P::Item) -> bool + Sync + Send,
pub fn any<Pred>(self, predicate: Pred) -> boolwhere Pred: Fn(P::Item) -> bool + Sync + Send,
pub fn all<Pred>(self, predicate: Pred) -> boolwhere Pred: Fn(P::Item) -> bool + Sync + Send,
pub fn while_some<T>(self) -> CondIterator<WhileSome<P>, WhileSome<S>>where P: ParallelIterator<Item = Option<T>>, S: Iterator<Item = Option<T>>, T: Send,
pub fn collect<C>(self) -> Cwhere C: FromCondIterator<P::Item>,
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,
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,
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,
pub fn intersperse( self, element: P::Item ) -> CondIterator<Intersperse<P>, Intersperse<S>>where P::Item: Clone,
pub fn opt_len(&self) -> Option<usize>
source§impl<P, S> CondIterator<P, S>where
P: ParallelIterator,
S: DoubleEndedIterator<Item = P::Item>,
impl<P, S> CondIterator<P, S>where P: ParallelIterator, S: DoubleEndedIterator<Item = P::Item>,
source§impl<P, S> CondIterator<P, S>where
P: IndexedParallelIterator,
S: Iterator<Item = P::Item>,
impl<P, S> CondIterator<P, S>where P: IndexedParallelIterator, S: Iterator<Item = P::Item>,
pub fn collect_into_vec(self, target: &mut Vec<P::Item>)
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,
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,
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,
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>,
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>,
pub fn cmp<I>(self, other: I) -> Orderingwhere I: IntoParallelIterator<Item = P::Item> + IntoIterator<Item = S::Item>, I::Iter: IndexedParallelIterator, P::Item: Ord,
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>,
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>,
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>,
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>,
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>,
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>,
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>,
pub fn enumerate(self) -> CondIterator<Enumerate<P>, Enumerate<S>>
pub fn skip(self, n: usize) -> CondIterator<Skip<P>, Skip<S>>
pub fn take(self, n: usize) -> CondIterator<Take<P>, Take<S>>
pub fn position_any<Pred>(self, predicate: Pred) -> Option<usize>where Pred: Fn(P::Item) -> bool + Sync + Send,
pub fn position_first<Pred>(self, predicate: Pred) -> Option<usize>where Pred: Fn(P::Item) -> bool + Sync + Send,
pub fn positions<Pred>( self, predicate: Pred ) -> CondIterator<Positions<P, Pred>, Positions<S, Pred>>where Pred: Fn(P::Item) -> bool + Sync + Send,
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>,
impl<P, S> CondIterator<P, S>where P: IndexedParallelIterator, S: DoubleEndedIterator<Item = P::Item>,
pub fn rev(self) -> CondIterator<Rev<P>, Rev<S>>
source§impl<P, S> CondIterator<P, S>where
P: IndexedParallelIterator,
S: ExactSizeIterator<Item = P::Item>,
impl<P, S> CondIterator<P, S>where P: IndexedParallelIterator, S: ExactSizeIterator<Item = P::Item>,
source§impl<P, S> CondIterator<P, S>where
P: IndexedParallelIterator,
S: ExactSizeIterator + DoubleEndedIterator<Item = P::Item>,
impl<P, S> CondIterator<P, S>where P: IndexedParallelIterator, S: ExactSizeIterator + DoubleEndedIterator<Item = P::Item>,
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more