Skip to main content

Zip

Struct Zip 

Source
pub struct Zip<I, J> { /* private fields */ }
Expand description

Zip adapter with standard shortest-input value semantics.

Trait Implementations§

Source§

impl<I, J> ParallelIterator for Zip<I, J>
where I: ParallelIterator, J: ParallelIterator, I::Item: Sync + 'static, J::Item: Sync + 'static,

Source§

fn drive<C, R>(self, consumer: C) -> R
where C: Consumer<Self::Item, Result = R> + Send + Sync, R: Send,

§Why this stays sequential (two sources, one split)

Pairing needs both inputs split at the same logical positions. The consumer protocol splits one source and hands the halves one consumer each; it carries no way to divide a second, independently shaped iterator in lockstep. Splitting the left input alone and re-driving the right per shard would re-run the right input once per shard, which is a different program, not a parallelisation of this one. zip_eq, interleave, and interleave_shortest share this boundary; interleaving additionally depends on alternation parity carrying across the shard boundary.

Source§

type Item = (<I as ParallelIterator>::Item, <J as ParallelIterator>::Item)

The type of items yielded by this parallel iterator.
Source§

fn seq_items(self) -> Vec<Self::Item>

Collect all items sequentially without routing through the consumer protocol.
Source§

fn seq_iter(self) -> impl Iterator<Item = Self::Item>

Convert the logical item stream into a sequential iterator. Read more
Source§

fn seq_try_fold<T, B, F>(self, init: T, fold_fn: F) -> ControlFlow<B, T>
where F: FnMut(T, Self::Item) -> ControlFlow<B, T>,

Fold this iterator’s logical item stream left to right, stopping at the first ControlFlow::Break. Read more
Source§

fn seq_fold<T, F>(self, init: T, fold_fn: F) -> T
where F: FnMut(T, Self::Item) -> T,

Fold this iterator’s logical item stream left to right. Read more
Source§

fn seq_items_window(self, skip: usize, take: Option<usize>) -> Vec<Self::Item>

Collect a logical window from the sequential item stream.
Source§

fn seq_items_reversed(self) -> Vec<Self::Item>

Collect items in reverse logical order.
Source§

fn seq_items_reversed_prefix(self, count: usize) -> Vec<Self::Item>

Collect a prefix from the reversed logical item stream.
Source§

fn map<F, R>(self, map_fn: F) -> Map<Self, F>
where F: Fn(Self::Item) -> R + Send + Sync + Clone, R: Send,

Map operation that transforms each element in parallel.
Source§

fn map_with<T, F, R>(self, init: T, map_fn: F) -> MapWith<Self, T, F>
where T: Send + Clone, F: Fn(&mut T, Self::Item) -> R + Send + Sync + Clone, R: Send + Sync + 'static,

Map operation with cloned per-operation state.
Source§

fn map_init<Init, T, F, R>( self, init: Init, map_fn: F, ) -> MapInit<Self, Init, F>
where Init: Fn() -> T + Send + Sync + Clone, T: Send, F: Fn(&mut T, Self::Item) -> R + Send + Sync + Clone, R: Send + Sync + 'static,

Map operation with lazily initialized state.
Source§

fn update<F>(self, update_fn: F) -> Update<Self, F>
where F: Fn(&mut Self::Item) + Send + Sync + Clone, Self::Item: Sync + 'static,

Mutate each item by reference and yield the mutated item.
Source§

fn filter<F>(self, filter_fn: F) -> Filter<Self, F>
where F: Fn(&Self::Item) -> bool + Send + Sync + Clone,

Filter operation that retains elements matching a predicate.
Source§

fn inspect<F>(self, inspect_fn: F) -> Inspect<Self, F>
where F: Fn(&Self::Item) + Send + Sync + Clone, Self::Item: Sync,

Inspect each element by shared reference without changing the stream.
Source§

fn panic_fuse(self) -> PanicFuse<Self>
where Self::Item: Sync,

Preserve value semantics while stopping sibling work after panic where applicable.
Source§

fn filter_map<F, R>(self, filter_map_fn: F) -> FilterMap<Self, F>
where F: Fn(Self::Item) -> Option<R> + Send + Sync + Clone, R: Send + Sync + 'static,

Map each element to an optional value and retain present values.
Source§

fn while_some<T>(self) -> WhileSome<Self>
where Self: ParallelIterator<Item = Option<T>>, T: Send + Sync + 'static,

Unwrap a prefix of present values from an optional stream.
Source§

fn flat_map<F, U>(self, flat_map_fn: F) -> FlatMap<Self, F>
where F: Fn(Self::Item) -> U + Send + Sync + Clone, U: IntoIterator, U::Item: Send + Sync + 'static,

Map each element to an iterator and flatten the resulting sequence.
Source§

fn flat_map_iter<F, U>(self, flat_map_fn: F) -> FlatMap<Self, F>
where F: Fn(Self::Item) -> U + Send + Sync + Clone, U: IntoIterator, U::Item: Send + Sync + 'static,

Map each element to a serial iterator and flatten the resulting sequence.
Source§

fn flatten(self) -> Flatten<Self>
where Self::Item: IntoIterator, <Self::Item as IntoIterator>::Item: Send + Sync + 'static,

Flatten nested item streams with standard left-to-right semantics.
Source§

fn flatten_iter(self) -> Flatten<Self>
where Self::Item: IntoIterator, <Self::Item as IntoIterator>::Item: Send + Sync + 'static,

Flatten nested serial iterators with standard left-to-right semantics.
Source§

fn enumerate(self) -> Enumerate<Self>
where Self::Item: Sync + 'static,

Pair each element with its zero-based position in the logical sequence.
Source§

fn zip<J>(self, other: J) -> Zip<Self, J>
where J: ParallelIterator, Self::Item: Sync + 'static, J::Item: Sync + 'static,

Pair elements with another parallel iterator, stopping at the shorter input.
Source§

fn zip_eq<J>(self, other: J) -> ZipEq<Self, J>
where J: ParallelIterator, Self::Item: Sync + 'static, J::Item: Sync + 'static,

Pair elements with another parallel iterator and require equal lengths.
Source§

fn take(self, count: usize) -> Take<Self>
where Self::Item: Sync + 'static,

Retain at most count elements from the logical sequence prefix.
Source§

fn take_any(self, count: usize) -> Take<Self>
where Self::Item: Sync + 'static,

Retain at most count items from this non-indexed deterministic stream.
Source§

fn skip(self, count: usize) -> Skip<Self>
where Self::Item: Sync + 'static,

Discard count elements from the logical sequence prefix.
Source§

fn skip_any(self, count: usize) -> Skip<Self>
where Self::Item: Sync + 'static,

Discard count items from this non-indexed deterministic stream.
Source§

fn take_any_while<F>(self, predicate: F) -> TakeAnyWhile<Self, F>
where F: Fn(&Self::Item) -> bool + Send + Sync + Clone, Self::Item: Sync + 'static,

Retain this deterministic stream prefix while predicate returns true.
Source§

fn skip_any_while<F>(self, predicate: F) -> SkipAnyWhile<Self, F>
where F: Fn(&Self::Item) -> bool + Send + Sync + Clone, Self::Item: Sync + 'static,

Discard this deterministic stream prefix while predicate returns true.
Source§

fn chain<J>(self, other: J) -> Chain<Self, J>
where J: ParallelIterator<Item = Self::Item>, Self::Item: Sync + 'static,

Concatenate this iterator with another iterator of the same item type.
Source§

fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
where Self::Item: Clone + Sync + 'static,

Insert a cloned separator between adjacent logical items.
Source§

fn rev(self) -> Rev<Self>
where Self::Item: Sync + 'static,

Reverse the logical sequence order.
Source§

fn chunks(self, chunk_size: usize) -> Chunks<Self>
where Self::Item: Sync + 'static,

Group the logical item stream into non-empty chunks.
Source§

fn copied<'data, T>(self) -> Copied<Self>
where Self: ParallelIterator<Item = &'data T>, T: Copy + Send + Sync + 'data + 'static,

Copy referenced items out of a borrowed parallel stream.
Source§

fn cloned<'data, T>(self) -> Cloned<Self>
where Self: ParallelIterator<Item = &'data T>, T: Clone + Send + Sync + 'data + 'static,

Clone referenced items out of a borrowed parallel stream.
Source§

fn reduce<F>(self, reduce_fn: F) -> Option<Self::Item>
where F: Fn(Self::Item, Self::Item) -> Self::Item + Send + Sync + Clone, Self::Item: Clone + Sync,

Reduce operation that combines all elements.
Source§

fn fold<T, F>(self, init: T, fold_fn: F) -> T
where T: Send + Sync + Clone, F: Fn(T, Self::Item) -> T + Send + Sync + Clone, Self::Item: Sync,

Fold operation with an initial value.
Source§

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

Collect into a collection.
Source§

fn collect_vec_list(self) -> LinkedList<Vec<Self::Item>>

Collect into a list of owned vector segments. Read more
Source§

fn partition<C, F>(self, predicate: F) -> (C, C)
where C: FromIterator<Self::Item> + Send, F: Fn(&Self::Item) -> bool + Send + Sync + Clone, Self::Item: Sync + 'static,

Partition items into two collections while preserving relative order.
Source§

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

Split mapped Either values into two collections while preserving side-local order.
Source§

fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
where Self: ParallelIterator<Item = (A, B)>, FromA: Default + Extend<A> + Send, FromB: Default + Extend<B> + Send, A: Send, B: Send,

Split a stream of pairs into two collections while preserving order.
Source§

fn sequential(self) -> SequentialAdapter<Self>

Convert to a sequential iterator.
Source§

fn count(self) -> usize
where Self::Item: Sync,

Count the number of elements.
Source§

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

Find the first element matching a predicate. Read more
Source§

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

Find the last element matching a predicate in the logical stream.
Source§

fn position_first<F>(self, predicate: F) -> Option<usize>
where F: Fn(Self::Item) -> bool + Send + Sync + Clone,

Find the first logical index matching a predicate. Read more
Source§

fn position_any<F>(self, predicate: F) -> Option<usize>
where F: Fn(Self::Item) -> bool + Send + Sync + Clone,

Find any logical index matching a predicate.
Source§

fn position_last<F>(self, predicate: F) -> Option<usize>
where F: Fn(Self::Item) -> bool + Send + Sync + Clone,

Find the last logical index matching a predicate. Read more
Source§

fn positions<F>(self, predicate: F) -> Positions<Self, F>
where F: Fn(Self::Item) -> bool + Send + Sync + Clone,

Return all logical indices whose items match a predicate.
Source§

fn find_map_first<F, R>(self, map_fn: F) -> Option<R>
where F: Fn(Self::Item) -> Option<R> + Send + Sync + Clone, R: Send,

Find and map the first matching element in the logical stream.
Source§

fn find_map_any<F, R>(self, map_fn: F) -> Option<R>
where F: Fn(Self::Item) -> Option<R> + Send + Sync + Clone, R: Send,

Find and map any matching element in the logical stream. Read more
Source§

fn find_map_last<F, R>(self, map_fn: F) -> Option<R>
where F: Fn(Self::Item) -> Option<R> + Send + Sync + Clone, R: Send,

Find and map the last matching element in the logical stream.
Source§

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

Test if any element matches a predicate.
Source§

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

Test if all elements match a predicate.
Source§

fn for_each<F>(self, op: F)
where F: Fn(Self::Item) + Send + Sync + Clone,

Apply a function to each element.
Source§

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

Apply a function to each element with cloned per-operation state. Read more
Source§

fn for_each_init<Init, T, F>(self, init: Init, op: F)
where Init: Fn() -> T + Send + Sync + Clone, T: Send, F: Fn(&mut T, Self::Item) + Send + Sync + Clone,

Apply a function to each element with lazily initialized state. Read more
Source§

fn try_for_each<F, E>(self, op: F) -> Result<(), E>
where F: Fn(Self::Item) -> Result<(), E> + Send + Sync + Clone, E: Send,

Apply a fallible function to each element and stop on the first error. Read more
Source§

fn try_for_each_with<T, F, E>(self, init: T, op: F) -> Result<(), E>
where T: Send + Clone, F: Fn(&mut T, Self::Item) -> Result<(), E> + Send + Sync + Clone, E: Send,

Apply a fallible function to each element with cloned per-operation state. Read more
Source§

fn try_for_each_init<Init, T, F, E>(self, init: Init, op: F) -> Result<(), E>
where Init: Fn() -> T + Send + Sync + Clone, T: Send, F: Fn(&mut T, Self::Item) -> Result<(), E> + Send + Sync + Clone, E: Send,

Apply a fallible function to each element with lazily initialized state. Read more
Source§

fn reduce_with<F>(self, reduce_fn: F) -> Option<Self::Item>
where F: Fn(Self::Item, Self::Item) -> Self::Item + Send + Sync + Clone, Self::Item: Sync + Clone,

Reduce with an associative operation.
Source§

fn try_reduce<Identity, F, T, E>( self, identity: Identity, reduce_fn: F, ) -> Result<T, E>
where Self::Item: Into<Result<T, E>>, Identity: Fn() -> T + Send + Sync + Clone, F: Fn(T, T) -> Result<T, E> + Send + Sync + Clone, T: Send, E: Send,

Reduce a fallible item stream with an identity and associative operation.
Source§

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

Sum the complete logical stream through one standard Iterator::sum invocation. Read more
Source§

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

Sum independently produced item fragments and merge their outputs. Read more
Source§

fn product<P>(self) -> P
where P: Product<Self::Item> + Send,

Multiply the complete logical stream through one standard Iterator::product invocation. Read more
Source§

fn product_reassociated<P>(self) -> P
where P: Product<Self::Item> + Product<P> + Send,

Multiply independently produced item fragments and merge their outputs. Read more
Source§

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

Return the minimum item in the logical stream.
Source§

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

Return the maximum item in the logical stream.
Source§

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

Return the minimum item according to a comparator. Read more
Source§

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

Return the maximum item according to a comparator. Read more
Source§

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

Return the minimum item according to an ordered key. Read more
Source§

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

Return the maximum item according to an ordered key. Read more
Source§

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

Find any element matching a predicate. Read more

Auto Trait Implementations§

§

impl<I, J> Freeze for Zip<I, J>
where I: Freeze, J: Freeze,

§

impl<I, J> RefUnwindSafe for Zip<I, J>

§

impl<I, J> Send for Zip<I, J>
where I: Send, J: Send,

§

impl<I, J> Sync for Zip<I, J>
where I: Sync, J: Sync,

§

impl<I, J> Unpin for Zip<I, J>
where I: Unpin, J: Unpin,

§

impl<I, J> UnsafeUnpin for Zip<I, J>
where I: UnsafeUnpin, J: UnsafeUnpin,

§

impl<I, J> UnwindSafe for Zip<I, J>
where I: UnwindSafe, J: 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<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, 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.