Skip to main content

IndexedParallelIterator

Trait IndexedParallelIterator 

Source
pub trait IndexedParallelIterator: ParallelIterator {
    // Required method
    fn len(&self) -> usize;

    // Provided methods
    fn is_empty(&self) -> bool { ... }
    fn collect_into_vec(self, target: &mut Vec<Self::Item>) { ... }
    fn unzip_into_vecs<A, B>(self, left: &mut Vec<A>, right: &mut Vec<B>)
       where Self: ParallelIterator<Item = (A, B)>,
             A: Send,
             B: Send { ... }
    fn interleave<J>(self, other: J) -> Interleave<Self, J::Iter>
       where J: IntoParallelIterator<Item = Self::Item>,
             J::Iter: IndexedParallelIterator<Item = Self::Item>,
             Self::Item: Sync + 'static { ... }
    fn interleave_shortest<J>(
        self,
        other: J,
    ) -> InterleaveShortest<Self, J::Iter>
       where J: IntoParallelIterator<Item = Self::Item>,
             J::Iter: IndexedParallelIterator<Item = Self::Item>,
             Self::Item: Sync + 'static { ... }
    fn step_by(self, step: usize) -> StepBy<Self>
       where Self::Item: Sync + 'static { ... }
    fn by_exponential_blocks(self) -> ExponentialBlocks<Self>
       where Self::Item: Sync + 'static { ... }
    fn by_uniform_blocks(self, block_size: usize) -> UniformBlocks<Self>
       where Self::Item: Sync + 'static { ... }
}
Expand description

Exact-size boundary for Moirai’s bounded Rayon-style indexed source subset.

This trait deliberately covers source iterators with known cardinality. It does not claim Rayon’s full indexed producer/consumer adapter model.

Required Methods§

Source

fn len(&self) -> usize

Return the exact number of logical items in the indexed source.

Provided Methods§

Source

fn is_empty(&self) -> bool

Return whether the indexed source has no logical items.

Source

fn collect_into_vec(self, target: &mut Vec<Self::Item>)

Move all items into caller-provided storage.

The destination vector is cleared but keeps its allocation, matching the bounded source contract for exact-size streams without requiring item cloning or allocating a second output vector.

Source

fn unzip_into_vecs<A, B>(self, left: &mut Vec<A>, right: &mut Vec<B>)
where Self: ParallelIterator<Item = (A, B)>, A: Send, B: Send,

Split pair items into caller-provided left and right storage.

Both destination vectors are cleared but keep their allocations. Pair values are moved into their target sides exactly once, preserving the bounded exact-size source contract without cloning either side.

Source

fn interleave<J>(self, other: J) -> Interleave<Self, J::Iter>
where J: IntoParallelIterator<Item = Self::Item>, J::Iter: IndexedParallelIterator<Item = Self::Item>, Self::Item: Sync + 'static,

Alternately yield items from this source and another exact-size source.

Values are moved from both sources into one logical stream. When one side is exhausted, remaining values from the other side are yielded.

Source

fn interleave_shortest<J>(self, other: J) -> InterleaveShortest<Self, J::Iter>
where J: IntoParallelIterator<Item = Self::Item>, J::Iter: IndexedParallelIterator<Item = Self::Item>, Self::Item: Sync + 'static,

Alternately yield items until the shorter exact-size source is consumed.

This matches Rayon’s indexed boundary: if the left source is longer, one trailing left item is retained after the final right item.

Source

fn step_by(self, step: usize) -> StepBy<Self>
where Self::Item: Sync + 'static,

Yield every stepth item from an exact-size source.

The step size must be non-zero. Skipped items remain owned by the consumed source iterator and are dropped exactly once.

Source

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

Convert this exact-size source into value-preserving exponential blocks.

This bounded adapter preserves logical item order and exposes Rayon’s block-hint API surface. It does not claim Rayon’s full indexed producer/consumer block-splitting scheduler model.

Source

fn by_uniform_blocks(self, block_size: usize) -> UniformBlocks<Self>
where Self::Item: Sync + 'static,

Convert this exact-size source into value-preserving uniform blocks.

The block size must be non-zero. This bounded adapter validates the block-size contract and preserves logical item order without claiming Rayon’s full block-splitting producer model.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§