Skip to main content

ParIter

Struct ParIter 

Source
pub struct ParIter<I, X, R = AdaptiveChunkRunner<DefaultPool>>
where I: ConcurrentIter, X: Xap<I = I::Item>, R: ParRunner,
{ /* private fields */ }
Expand description

Parallel iterator.

Trait Implementations§

Source§

impl<I, X, R> IntoIterator for ParIter<I, X, R>
where I: ConcurrentIter, X: Xap<I = I::Item>, R: ParRunner,

Source§

type Item = <X as Xap>::O

The type of the elements being iterated over.
Source§

type IntoIter = XapIter<<I as ConcurrentIter>::SequentialIter, X>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<I, X, R> Par for ParIter<I, X, R>
where I: ConcurrentIter, X: Xap<I = I::Item>, R: ParRunner,

Source§

fn runner<Q: ParRunner>( self, runner: Q, ) -> impl Par<Item = Self::Item, Xap = Self::Xap, Input = Self::Input>

Replaces the current parallel runner with runner. Read more
Source§

fn runner_with_diagnostics( self, ) -> impl Par<Item = Self::Item, Xap = Self::Xap, Input = Self::Input>

Wraps the current parallel runner with a diagnostics-enabled runner. Read more
Source§

fn num_threads(self, num_threads: impl Into<NumThreads>) -> Self

Sets the maximum number of worker threads for this computation. Read more
Source§

fn chunk_size(self, chunk_size: impl Into<ChunkSize>) -> Self

Sets chunk size used when pulling items from the concurrent input. Read more
Source§

fn iteration_order(self, collect: IterationOrder) -> Self

Sets iteration order semantics for operations sensitive to ordering. Read more
Source§

fn map<Q, H>( self, h: H, ) -> impl Par<Item = Q, Xap = MapOf<Self::Xap, Q, H>, Input = Self::Input>
where H: Fn(X::O) -> Q + Copy + Send,

Maps each element with closure h. Read more
Source§

fn inspect<H>( self, h: H, ) -> impl Par<Item = Self::Item, Xap = InsOf<Self::Xap, H>, Input = Self::Input>
where H: Fn(&Self::Item) + Copy + Send,

Runs h on each element and forwards the item unchanged. Read more
Source§

fn filter<H>( self, h: H, ) -> impl Par<Item = Self::Item, Xap = FilOf<Self::Xap, H>, Input = Self::Input>
where H: Fn(&Self::Item) -> bool + Copy + Send,

Keeps only elements satisfying predicate h. Read more
Source§

fn filter_map<Q, H>( self, h: H, ) -> impl Par<Item = Q, Xap = FilMapOf<Self::Xap, Q, H>, Input = Self::Input>
where H: Fn(Self::Item) -> Option<Q> + Copy + Send,

Maps and filters in a single pass. Read more
Source§

fn flat_map<V, H>( self, h: H, ) -> impl Par<Item = V::Item, Xap = FlatMapOf<Self::Xap, V, H>, Input = Self::Input>
where V: IntoIterator, H: Fn(Self::Item) -> V + Copy + Send,

Maps each element to an iterator and flattens one level. Read more
Source§

fn flatten( self, ) -> impl Par<Item = <Self::Item as IntoIterator>::Item, Xap = FlattenOf<Self::Xap>, Input = Self::Input>
where Self::Item: IntoIterator,

Flattens one level of nested iterables. Read more
Source§

fn size_hint(&self) -> (usize, Option<usize>)

Returns a lower and optional upper bound on the number of output items. Read more
Source§

fn first(self) -> Option<X::O>
where X::O: Send,

Returns the first item according to iteration order, or None if empty. Read more
Source§

fn reduce<F>(self, f: F) -> Option<X::O>
where F: Fn(X::O, X::O) -> X::O + Send + Copy, X::O: Send,

Reduces items into one value using associative reducer f. Read more
Source§

fn collect_into<P>(self, dst: &mut P)
where P: ParExtend<X::O>, X::O: Send,

Collects all items into dst. Read more
Source§

fn into_optional<T>( self, ) -> impl ParOption<Elem = T, Xap1 = Self::Xap, M = T, Xap2 = Id<T>, Input = Self::Input, Size = <<Self::Xap as Xap>::Size as Size>::IntoPair>
where Self::Xap: Xap<O = Option<T>>,

Converts Par<Item = Option<T>> into ParOption<Item = T>. Read more
Source§

fn into_fallible<T, E>( self, ) -> impl ParResult<Elem = T, Error = E, Xap1 = Self::Xap, M = T, Xap2 = Id<T>, Input = Self::Input, Size = <<Self::Xap as Xap>::Size as Size>::IntoPair>
where Self::Xap: Xap<O = Result<T, E>>,

Converts Par<Item = Result<T, E>> into ParResult<Item = T, Error = E>. Read more
Source§

fn use_new<U, F>( self, f: F, ) -> impl ParUse<Item = Self::Item, Use = U, Xap = IdUse<Self::Xap, U>, Input = Self::Input>
where U: Send, F: Fn(usize) -> U + Sync,

Creates one mutable Use value per participating worker. Read more
Source§

fn use_vec<U, F>( self, use_vec: &mut UseVec<U, F>, ) -> impl ParUse<Item = Self::Item, Use = U, Xap = IdUse<Self::Xap, U>, Input = Self::Input>
where U: Send, F: Fn(usize) -> U + Sync,

Uses an externally owned UseVec as worker-local mutable state. Read more
Source§

fn use_slice<'a, U>( self, slice: &'a mut [U], ) -> impl ParUse<Item = Self::Item, Use = U, Xap = IdUse<Self::Xap, U>, Input = Self::Input>
where U: Send + 'a,

Uses a caller-provided mutable slice as worker-local mutable state. Read more
Source§

fn copied<'a, O>( self, ) -> impl Par<Item = O, Xap = MappedOf<Self::Xap, FnCopied<'a, O>>, Input = Self::Input>
where Self: Par<Item = &'a O>, O: Copy + 'a,

Copies elements of a reference iterator. Read more
Source§

fn cloned<'a, O>( self, ) -> impl Par<Item = O, Xap = MappedOf<Self::Xap, FnCloned<'a, O>>, Input = Self::Input>
where Self: Par<Item = &'a O>, O: Clone + 'a,

Clones elements of a reference iterator. Read more
Source§

fn len(&self) -> usize
where Self::Input: ExactSizeConcurrentIter, Self::Xap: Xap<Size = One>,

Returns the exact number of output items. Read more
Source§

fn is_empty(&self) -> bool
where Self::Input: ExactSizeConcurrentIter, Self::Xap: Xap<Size = One>,

Returns true when the parallel iterator has no output items. Read more
Source§

fn collect<P>(self) -> P
where P: ParExtend<Self::Item> + Default, Self::Item: Send,

Collects all items into a new collection. Read more
Source§

fn all<F>(self, f: F) -> bool
where F: Fn(&Self::Item) -> bool + Sync,

Returns true if all items satisfy predicate f. Read more
Source§

fn any<F>(self, f: F) -> bool
where F: Fn(&Self::Item) -> bool + Sync,

Returns true if any item satisfies predicate f. Read more
Source§

fn count(self) -> usize

Counts elements. Read more
Source§

fn find<F>(self, f: F) -> Option<Self::Item>
where Self::Item: Send, F: Fn(&Self::Item) -> bool + Sync,

Finds first (Ordered, default) or any (Arbitrary) item satisfying predicate f. Read more
Source§

fn fold<B, I, F>(self, init: I, f: F) -> Vec<B>
where B: Send, I: Fn() -> B + Sync, F: Fn(&mut B, Self::Item) + Copy + Send,

Folds elements into per-thread accumulators and returns them. Read more
Source§

fn for_each<F>(self, f: F)
where F: Fn(Self::Item) + Send + Copy,

Executes f for each item. Read more
Source§

fn max(self) -> Option<Self::Item>
where Self::Item: Ord + Send,

Returns maximum element, or None if empty. Read more
Source§

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

Returns element considered maximum by comparator f. Read more
Source§

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

Returns element with maximum key value. Read more
Source§

fn min(self) -> Option<Self::Item>
where Self::Item: Ord + Send,

Returns minimum element, or None if empty. Read more
Source§

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

Returns element considered minimum by comparator f. Read more
Source§

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

Returns element with minimum key value. Read more
Source§

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

Sums elements using Sum implementation of the item type. Read more

Auto Trait Implementations§

§

impl<I, X, R> Freeze for ParIter<I, X, R>
where I: Freeze, X: Freeze, R: Freeze,

§

impl<I, X, R> RefUnwindSafe for ParIter<I, X, R>

§

impl<I, X, R> Send for ParIter<I, X, R>
where I: Send, R: Send,

§

impl<I, X, R> Sync for ParIter<I, X, R>
where X: Sync,

§

impl<I, X, R> Unpin for ParIter<I, X, R>
where I: Unpin, X: Unpin, R: Unpin,

§

impl<I, X, R> UnsafeUnpin for ParIter<I, X, R>

§

impl<I, X, R> UnwindSafe for ParIter<I, X, R>
where I: UnwindSafe, X: UnwindSafe, R: UnwindSafe,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<P> EnumeratePar for P
where P: Par, <P as ParCore>::Xap: XapEnumByInput,

Source§

fn enumerate(self) -> impl Par
where <P as ParCore>::Xap: XapEnumByInput,

Transforms each item into (index, item). 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 T
where 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.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

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

impl<T> SoM<T> for T

Source§

fn get_ref(&self) -> &T

Returns a reference to self.
Source§

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

Returns a mutable reference to self.
Source§

impl<T> SoR<T> for T

Source§

fn get_ref(&self) -> &T

Returns a reference to self.
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.