pub struct ParOption<F, T, R = DefaultRunner>{ /* private fields */ }
Expand description
A parallel iterator for which the computation either completely succeeds, or fails and early exits with None.
Trait Implementations§
Source§impl<F, T, R> ParIterOption<R> for ParOption<F, T, R>
impl<F, T, R> ParIterOption<R> for ParOption<F, T, R>
Source§type Item = T
type Item = T
Type of the success element, to be received as the Some variant iff the entire computation succeeds.
Source§fn num_threads(self, num_threads: impl Into<NumThreads>) -> Self
fn num_threads(self, num_threads: impl Into<NumThreads>) -> Self
Sets the number of threads to be used in the parallel execution.
Integers can be used as the argument with the following mapping: Read more
Source§fn chunk_size(self, chunk_size: impl Into<ChunkSize>) -> Self
fn chunk_size(self, chunk_size: impl Into<ChunkSize>) -> Self
Sets the number of elements to be pulled from the concurrent iterator during the
parallel execution. When integers are used as argument, the following mapping applies: Read more
Source§fn iteration_order(self, order: IterationOrder) -> Self
fn iteration_order(self, order: IterationOrder) -> Self
Sets the iteration order of the parallel computation. Read more
Source§fn with_runner<Q: ParallelRunner>(
self,
orchestrator: Q,
) -> impl ParIterOption<Q, Item = Self::Item>
fn with_runner<Q: ParallelRunner>( self, orchestrator: Q, ) -> impl ParIterOption<Q, Item = Self::Item>
Rather than the
DefaultRunner
, uses the parallel runner Q
which implements ParallelRunner
. Read moreSource§fn map<Out, Map>(self, map: Map) -> impl ParIterOption<R, Item = Out>
fn map<Out, Map>(self, map: Map) -> impl ParIterOption<R, Item = Out>
Takes a closure
map
and creates a parallel iterator which calls that closure on each element. Read moreSource§fn filter<Filter>(
self,
filter: Filter,
) -> impl ParIterOption<R, Item = Self::Item>
fn filter<Filter>( self, filter: Filter, ) -> impl ParIterOption<R, Item = Self::Item>
Creates an iterator which uses a closure
filter
to determine if an element should be yielded. Read moreSource§fn flat_map<IOut, FlatMap>(
self,
flat_map: FlatMap,
) -> impl ParIterOption<R, Item = IOut::Item>
fn flat_map<IOut, FlatMap>( self, flat_map: FlatMap, ) -> impl ParIterOption<R, Item = IOut::Item>
Creates an iterator that works like map, but flattens nested structure. Read more
Source§fn filter_map<Out, FilterMap>(
self,
filter_map: FilterMap,
) -> impl ParIterOption<R, Item = Out>
fn filter_map<Out, FilterMap>( self, filter_map: FilterMap, ) -> impl ParIterOption<R, Item = Out>
Creates an iterator that both filters and maps. Read more
Source§fn inspect<Operation>(
self,
operation: Operation,
) -> impl ParIterOption<R, Item = Self::Item>
fn inspect<Operation>( self, operation: Operation, ) -> impl ParIterOption<R, Item = Self::Item>
Does something with each successful element of an iterator, passing the value on, provided that all elements are of Some variant;
short-circuits and returns None otherwise. Read more
Source§fn collect_into<C>(self, output: C) -> Option<C>
fn collect_into<C>(self, output: C) -> Option<C>
Collects all the items from an iterator into a collection iff all elements are of Some variant.
Early exits and returns None if any of the elements is None. Read more
Source§fn collect<C>(self) -> Option<C>
fn collect<C>(self) -> Option<C>
Transforms an iterator into a collection iff all elements are of Ok variant.
Early exits and returns the error if any of the elements is an Err. Read more
Source§fn reduce<Reduce>(self, reduce: Reduce) -> Option<Option<Self::Item>>
fn reduce<Reduce>(self, reduce: Reduce) -> Option<Option<Self::Item>>
Reduces the elements to a single one, by repeatedly applying a reducing operation.
Early exits and returns None if any of the elements is None. Read more
Source§fn first(self) -> Option<Option<Self::Item>>
fn first(self) -> Option<Option<Self::Item>>
Returns the first (or any) element of the iterator.
If the iterator is empty,
Some(None)
is returned.
Early exits and returns None if a None element is observed first. Read moreSource§fn with_pool<P: ParThreadPool>(
self,
pool: P,
) -> impl ParIterOption<RunnerWithPool<P, R::Executor>, Item = Self::Item>where
Self: Sized,
fn with_pool<P: ParThreadPool>(
self,
pool: P,
) -> impl ParIterOption<RunnerWithPool<P, R::Executor>, Item = Self::Item>where
Self: Sized,
Rather than
DefaultPool
, uses the parallel runner with the given pool
implementing
ParThreadPool
. Read moreSource§fn all<Predicate>(self, predicate: Predicate) -> Option<bool>
fn all<Predicate>(self, predicate: Predicate) -> Option<bool>
Tests if every element of the iterator matches a predicate.
Early exits and returns None if any of the elements is None. Read more
Source§fn any<Predicate>(self, predicate: Predicate) -> Option<bool>
fn any<Predicate>(self, predicate: Predicate) -> Option<bool>
Tests if any element of the iterator matches a predicate.
Early exits and returns None if any of the elements is None. Read more
Source§fn count(self) -> Option<usize>where
Self: Sized,
fn count(self) -> Option<usize>where
Self: Sized,
Consumes the iterator, counting the number of iterations and returning it.
Early exits and returns None if any of the elements is None. Read more
Source§fn for_each<Operation>(self, operation: Operation) -> Option<()>
fn for_each<Operation>(self, operation: Operation) -> Option<()>
Calls a closure on each element of an iterator, and returns
Ok(())
if all elements succeed.
Early exits and returns None if any of the elements is None. Read moreSource§fn max(self) -> Option<Option<Self::Item>>
fn max(self) -> Option<Option<Self::Item>>
Returns Some of maximum element of an iterator if all elements succeed.
If the iterator is empty,
Some(None)
is returned.
Early exits and returns None if any of the elements is None. Read moreSource§fn max_by<Compare>(self, compare: Compare) -> Option<Option<Self::Item>>
fn max_by<Compare>(self, compare: Compare) -> Option<Option<Self::Item>>
Returns the element that gives the maximum value with respect to the specified
compare
function.
If the iterator is empty, Some(None)
is returned.
Early exits and returns None if any of the elements is None. Read moreSource§fn max_by_key<Key, GetKey>(self, key: GetKey) -> Option<Option<Self::Item>>
fn max_by_key<Key, GetKey>(self, key: GetKey) -> Option<Option<Self::Item>>
Returns the element that gives the maximum value from the specified function.
If the iterator is empty,
Some(None)
is returned.
Early exits and returns None if any of the elements is None. Read moreSource§fn min(self) -> Option<Option<Self::Item>>
fn min(self) -> Option<Option<Self::Item>>
Returns Some of minimum element of an iterator if all elements succeed.
If the iterator is empty,
Some(None)
is returned.
Early exits and returns None if any of the elements is None. Read moreSource§fn min_by<Compare>(self, compare: Compare) -> Option<Option<Self::Item>>
fn min_by<Compare>(self, compare: Compare) -> Option<Option<Self::Item>>
Returns the element that gives the minimum value with respect to the specified
compare
function.
If the iterator is empty, Some(None)
is returned.
Early exits and returns None if any of the elements is None. Read moreSource§fn min_by_key<Key, GetKey>(self, get_key: GetKey) -> Option<Option<Self::Item>>
fn min_by_key<Key, GetKey>(self, get_key: GetKey) -> Option<Option<Self::Item>>
Returns the element that gives the minimum value from the specified function.
If the iterator is empty,
Some(None)
is returned.
Early exits and returns None if any of the elements is None. Read moreSource§fn sum<Out>(self) -> Option<Out>
fn sum<Out>(self) -> Option<Out>
Sums the elements of an iterator.
Early exits and returns None if any of the elements is None. Read more
Auto Trait Implementations§
impl<F, T, R> Freeze for ParOption<F, T, R>where
F: Freeze,
impl<F, T, R> RefUnwindSafe for ParOption<F, T, R>
impl<F, T, R> Send for ParOption<F, T, R>
impl<F, T, R> Sync for ParOption<F, T, R>
impl<F, T, R> Unpin for ParOption<F, T, R>
impl<F, T, R> UnwindSafe for ParOption<F, T, R>
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more