pub struct ParResult<I, T, E, R = RunnerWithPool<SequentialPool>>{ /* private fields */ }Expand description
A parallel iterator for which the computation either completely succeeds, or fails and early exits with an error.
Trait Implementationsยง
Sourceยงimpl<I, T, E, R> ParIterResult<R> for ParResult<I, T, E, R>
impl<I, T, E, R> ParIterResult<R> for ParResult<I, T, E, R>
Sourceยงtype Item = T
type Item = T
Type of the Ok element, to be received as the Ok variant iff the entire computation succeeds.
Sourceยงtype RegularItem = <I as ConcurrentIter>::Item
type RegularItem = <I as ConcurrentIter>::Item
Element type of the regular parallel iterator this fallible iterator can be converted to, simply
Result<Self::Ok, Self::Err>.Sourceยงtype RegularParIter = Par<I, R>
type RegularParIter = Par<I, R>
Regular parallel iterator this fallible iterator can be converted into.
Sourceยงfn con_iter_len(&self) -> Option<usize>
fn con_iter_len(&self) -> Option<usize>
Returns a reference to the input concurrent iterator.
Sourceยงfn into_regular_par(
self,
) -> <ParResult<I, T, E, R> as ParIterResult<R>>::RegularParIter
fn into_regular_par( self, ) -> <ParResult<I, T, E, R> as ParIterResult<R>>::RegularParIter
Converts this fallible iterator into a regular parallel iterator; i.e.,
ParIter, with Item = Result<Self::Ok, Self::Err>.Sourceยงfn from_regular_par(
regular_par: <ParResult<I, T, E, R> as ParIterResult<R>>::RegularParIter,
) -> ParResult<I, T, E, R>
fn from_regular_par( regular_par: <ParResult<I, T, E, R> as ParIterResult<R>>::RegularParIter, ) -> ParResult<I, T, E, R>
Converts the
regular_par iterator with Item = Result<Self::Ok, Self::Err> into fallible result iterator.Sourceยงfn with_runner<Q>(
self,
orchestrator: Q,
) -> impl ParIterResult<Q, Item = <ParResult<I, T, E, R> as ParIterResult<R>>::Item, Err = <ParResult<I, T, E, R> as ParIterResult<R>>::Err>where
Q: ParallelRunner,
fn with_runner<Q>(
self,
orchestrator: Q,
) -> impl ParIterResult<Q, Item = <ParResult<I, T, E, R> as ParIterResult<R>>::Item, Err = <ParResult<I, T, E, R> as ParIterResult<R>>::Err>where
Q: ParallelRunner,
Rather than the
DefaultRunner, uses the parallel runner Q which implements ParallelRunner. Read moreSourceยงfn collect_into<C>(
self,
output: C,
) -> Result<C, <ParResult<I, T, E, R> as ParIterResult<R>>::Err>where
C: ParCollectInto<<ParResult<I, T, E, R> as ParIterResult<R>>::Item>,
<ParResult<I, T, E, R> as ParIterResult<R>>::Item: Send,
<ParResult<I, T, E, R> as ParIterResult<R>>::Err: Send,
fn collect_into<C>(
self,
output: C,
) -> Result<C, <ParResult<I, T, E, R> as ParIterResult<R>>::Err>where
C: ParCollectInto<<ParResult<I, T, E, R> as ParIterResult<R>>::Item>,
<ParResult<I, T, E, R> as ParIterResult<R>>::Item: Send,
<ParResult<I, T, E, R> as ParIterResult<R>>::Err: Send,
Collects all the items from 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,
) -> Result<Option<<ParResult<I, T, E, R> as ParIterResult<R>>::Item>, <ParResult<I, T, E, R> as ParIterResult<R>>::Err>where
<ParResult<I, T, E, R> as ParIterResult<R>>::Item: Send,
<ParResult<I, T, E, R> as ParIterResult<R>>::Err: Send,
Reduce: Fn(<ParResult<I, T, E, R> as ParIterResult<R>>::Item, <ParResult<I, T, E, R> as ParIterResult<R>>::Item) -> <ParResult<I, T, E, R> as ParIterResult<R>>::Item + Sync,
fn reduce<Reduce>(
self,
reduce: Reduce,
) -> Result<Option<<ParResult<I, T, E, R> as ParIterResult<R>>::Item>, <ParResult<I, T, E, R> as ParIterResult<R>>::Err>where
<ParResult<I, T, E, R> as ParIterResult<R>>::Item: Send,
<ParResult<I, T, E, R> as ParIterResult<R>>::Err: Send,
Reduce: Fn(<ParResult<I, T, E, R> as ParIterResult<R>>::Item, <ParResult<I, T, E, R> as ParIterResult<R>>::Item) -> <ParResult<I, T, E, R> as ParIterResult<R>>::Item + Sync,
Reduces the elements to a single one, by repeatedly applying a reducing operation.
Early exits and returns the error if any of the elements is an Err. Read more
Sourceยงfn first(
self,
) -> Result<Option<<ParResult<I, T, E, R> as ParIterResult<R>>::Item>, <ParResult<I, T, E, R> as ParIterResult<R>>::Err>where
<ParResult<I, T, E, R> as ParIterResult<R>>::Item: Send,
<ParResult<I, T, E, R> as ParIterResult<R>>::Err: Send,
fn first(
self,
) -> Result<Option<<ParResult<I, T, E, R> as ParIterResult<R>>::Item>, <ParResult<I, T, E, R> as ParIterResult<R>>::Err>where
<ParResult<I, T, E, R> as ParIterResult<R>>::Item: Send,
<ParResult<I, T, E, R> as ParIterResult<R>>::Err: Send,
Returns the first (or any) element of the iterator.
If the iterator is empty,
Ok(None) is returned.
Early exits and returns the error if an Err element is observed first. Read moreSourceยงfn num_threads(self, num_threads: impl Into<NumThreads>) -> Selfwhere
Self: Sized,
fn num_threads(self, num_threads: impl Into<NumThreads>) -> Selfwhere
Self: Sized,
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>) -> Selfwhere
Self: Sized,
fn chunk_size(self, chunk_size: impl Into<ChunkSize>) -> Selfwhere
Self: Sized,
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) -> Selfwhere
Self: Sized,
fn iteration_order(self, order: IterationOrder) -> Selfwhere
Self: Sized,
Sets the iteration order of the parallel computation. Read more
Sourceยงfn with_pool<P>(
self,
pool: P,
) -> impl ParIterResult<RunnerWithPool<P, <R as ParallelRunner>::Executor>, Item = Self::Item, Err = Self::Err>where
P: ParThreadPool,
Self: Sized,
fn with_pool<P>(
self,
pool: P,
) -> impl ParIterResult<RunnerWithPool<P, <R as ParallelRunner>::Executor>, Item = Self::Item, Err = Self::Err>where
P: ParThreadPool,
Self: Sized,
Rather than
DefaultPool, uses the parallel runner with the given pool implementing
ParThreadPool. Read moreSourceยงfn map<Out, Map>(
self,
map: Map,
) -> impl ParIterResult<R, Item = Out, Err = Self::Err>
fn map<Out, Map>( self, map: Map, ) -> impl ParIterResult<R, Item = Out, Err = Self::Err>
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 ParIterResult<R, Item = Self::Item, Err = Self::Err>
fn filter<Filter>( self, filter: Filter, ) -> impl ParIterResult<R, Item = Self::Item, Err = Self::Err>
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 ParIterResult<R, Item = <IOut as IntoIterator>::Item, Err = Self::Err>where
Self: Sized,
IOut: IntoIterator,
<IOut as IntoIterator>::Item: Send,
FlatMap: Fn(Self::Item) -> IOut + Sync + Clone,
fn flat_map<IOut, FlatMap>(
self,
flat_map: FlatMap,
) -> impl ParIterResult<R, Item = <IOut as IntoIterator>::Item, Err = Self::Err>where
Self: Sized,
IOut: IntoIterator,
<IOut as IntoIterator>::Item: Send,
FlatMap: Fn(Self::Item) -> IOut + Sync + Clone,
Creates an iterator that works like map, but flattens nested structure. Read more
Sourceยงfn filter_map<Out, FilterMap>(
self,
filter_map: FilterMap,
) -> impl ParIterResult<R, Item = Out, Err = Self::Err>
fn filter_map<Out, FilterMap>( self, filter_map: FilterMap, ) -> impl ParIterResult<R, Item = Out, Err = Self::Err>
Creates an iterator that both filters and maps. Read more
Sourceยงfn inspect<Operation>(
self,
operation: Operation,
) -> impl ParIterResult<R, Item = Self::Item, Err = Self::Err>
fn inspect<Operation>( self, operation: Operation, ) -> impl ParIterResult<R, Item = Self::Item, Err = Self::Err>
Does something with each successful element of an iterator, passing the value on, provided that all elements are of Ok variant;
short-circuits and returns the error otherwise. Read more
Sourceยงfn collect<C>(self) -> Result<C, Self::Err>
fn collect<C>(self) -> Result<C, Self::Err>
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 all<Predicate>(self, predicate: Predicate) -> Result<bool, Self::Err>
fn all<Predicate>(self, predicate: Predicate) -> Result<bool, Self::Err>
Tests if every element of the iterator matches a predicate.
Early exits and returns the error if any of the elements is an Err. Read more
Sourceยงfn any<Predicate>(self, predicate: Predicate) -> Result<bool, Self::Err>
fn any<Predicate>(self, predicate: Predicate) -> Result<bool, Self::Err>
Tests if any element of the iterator matches a predicate.
Early exits and returns the error if any of the elements is an Err. Read more
Sourceยงfn count(self) -> Result<usize, Self::Err>
fn count(self) -> Result<usize, Self::Err>
Consumes the iterator, counting the number of iterations and returning it.
Early exits and returns the error if any of the elements is an Err. Read more
Sourceยงfn for_each<Operation>(self, operation: Operation) -> Result<(), Self::Err>
fn for_each<Operation>(self, operation: Operation) -> Result<(), Self::Err>
Calls a closure on each element of an iterator, and returns
Ok(()) if all elements succeed.
Early exits and returns the error if any of the elements is an Err. Read moreSourceยงfn max(self) -> Result<Option<Self::Item>, Self::Err>
fn max(self) -> Result<Option<Self::Item>, Self::Err>
Returns Ok of maximum element of an iterator if all elements succeed.
If the iterator is empty,
Ok(None) is returned.
Early exits and returns the error if any of the elements is an Err. Read moreSourceยงfn max_by<Compare>(
self,
compare: Compare,
) -> Result<Option<Self::Item>, Self::Err>
fn max_by<Compare>( self, compare: Compare, ) -> Result<Option<Self::Item>, Self::Err>
Returns the element that gives the maximum value with respect to the specified
compare function.
If the iterator is empty, Ok(None) is returned.
Early exits and returns the error if any of the elements is an Err. Read moreSourceยงfn max_by_key<Key, GetKey>(
self,
key: GetKey,
) -> Result<Option<Self::Item>, Self::Err>
fn max_by_key<Key, GetKey>( self, key: GetKey, ) -> Result<Option<Self::Item>, Self::Err>
Returns the element that gives the maximum value from the specified function.
If the iterator is empty,
Ok(None) is returned.
Early exits and returns the error if any of the elements is an Err. Read moreSourceยงfn min(self) -> Result<Option<Self::Item>, Self::Err>
fn min(self) -> Result<Option<Self::Item>, Self::Err>
Returns Ok of minimum element of an iterator if all elements succeed.
If the iterator is empty,
Ok(None) is returned.
Early exits and returns the error if any of the elements is an Err. Read moreSourceยงfn min_by<Compare>(
self,
compare: Compare,
) -> Result<Option<Self::Item>, Self::Err>
fn min_by<Compare>( self, compare: Compare, ) -> Result<Option<Self::Item>, Self::Err>
Returns the element that gives the maximum value with respect to the specified
compare function.
If the iterator is empty, Ok(None) is returned.
Early exits and returns the error if any of the elements is an Err. Read moreSourceยงfn min_by_key<Key, GetKey>(
self,
get_key: GetKey,
) -> Result<Option<Self::Item>, Self::Err>
fn min_by_key<Key, GetKey>( self, get_key: GetKey, ) -> Result<Option<Self::Item>, Self::Err>
Returns the element that gives the minimum value from the specified function.
If the iterator is empty,
Ok(None) is returned.
Early exits and returns the error if any of the elements is an Err. Read moreSourceยงfn sum<Out>(self) -> Result<Out, Self::Err>
fn sum<Out>(self) -> Result<Out, Self::Err>
Sums the elements of an iterator.
Early exits and returns the error if any of the elements is an Err. Read more
Sourceยงfn find<Predicate>(
self,
predicate: Predicate,
) -> Result<Option<Self::Item>, Self::Err>
fn find<Predicate>( self, predicate: Predicate, ) -> Result<Option<Self::Item>, Self::Err>
Returns the first (or any) element of the iterator that satisfies the
predicate.
If the iterator is empty, Ok(None) is returned.
Early exits and returns the error if an Err element is observed first. Read moreAuto Trait Implementationsยง
impl<I, T, E, R> Freeze for ParResult<I, T, E, R>
impl<I, T, E, R> RefUnwindSafe for ParResult<I, T, E, R>
impl<I, T, E, R> Send for ParResult<I, T, E, R>
impl<I, T, E, R> Sync for ParResult<I, T, E, R>
impl<I, T, E, R> Unpin for ParResult<I, T, E, R>
impl<I, T, E, R> UnwindSafe for ParResult<I, T, E, 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