Trait orx_concurrent_iter::AtomicIter

source ·
pub trait AtomicIter: Send + Sync {
    type Item: Send + Sync;

    // Required methods
    fn counter(&self) -> &AtomicCounter;
    fn get(&self, item_idx: usize) -> Option<Self::Item>;
    fn fetch_n(&self, n: usize) -> impl NextChunk<Self::Item>;

    // Provided method
    fn fetch_one(&self) -> Option<Next<Self::Item>> { ... }
}
Expand description

Trait defining a set of concurrent iterators which internally uses an atomic counter of elements to be yielded.

Note that every A: AtomicIter also implements ConcurrentIter.

Required Associated Types§

source

type Item: Send + Sync

Type of the items that the iterator yields.

Required Methods§

source

fn counter(&self) -> &AtomicCounter

Returns a reference to the underlying advanced item counter.

source

fn get(&self, item_idx: usize) -> Option<Self::Item>

Returns the item_idx-th item that the iterator yields; returns None if the iterator completes before.

source

fn fetch_n(&self, n: usize) -> impl NextChunk<Self::Item>

Returns an iterator of the next n consecutive items that the iterator yields. It might return an iterator of less or no items if the iteration does not have sufficient elements left.

Provided Methods§

source

fn fetch_one(&self) -> Option<Next<Self::Item>>

Returns the next item that the iterator yields; returns None if the iteration has completed.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<'a, T: Send + Sync> AtomicIter for ConIterOfSlice<'a, T>

§

type Item = &'a T

source§

impl<Idx> AtomicIter for ConIterOfRange<Idx>
where Idx: Send + Sync + Clone + Copy + From<usize> + Into<usize> + Add<Idx, Output = Idx> + Sub<Idx, Output = Idx> + Ord,

§

type Item = Idx

source§

impl<T: Send + Sync + Default> AtomicIter for ConIterOfVec<T>

§

type Item = T

source§

impl<T: Send + Sync, Iter> AtomicIter for ConIterOfIter<T, Iter>
where Iter: Iterator<Item = T>,

§

type Item = T

source§

impl<const N: usize, T: Send + Sync + Default> AtomicIter for ConIterOfArray<N, T>

§

type Item = T