Struct orx_concurrent_iter::ConIterOfIter
source · pub struct ConIterOfIter<T: Send + Sync, Iter>where
Iter: Iterator<Item = T>,{ /* private fields */ }Expand description
A regular Iter: Iterator ascended to the concurrent programs with use of atomics.
Since ConIterOfIter can wrap up any Iterator and enable concurrent iteration,
it might be considered as the most general ConcurrentIter implementation.
In performance critical scenarios and whenever possible, it might be preferable to use a more specific implementation such as crate::ConIterOfSlice.
Implementations§
Trait Implementations§
source§impl<T: Send + Sync, Iter> AtomicIter<T> for ConIterOfIter<T, Iter>where
Iter: Iterator<Item = T>,
impl<T: Send + Sync, Iter> AtomicIter<T> for ConIterOfIter<T, Iter>where
Iter: Iterator<Item = T>,
source§fn counter(&self) -> &AtomicCounter
fn counter(&self) -> &AtomicCounter
Returns a reference to the underlying advanced item counter.
source§fn progress_and_get_begin_idx(&self, number_to_fetch: usize) -> Option<usize>
fn progress_and_get_begin_idx(&self, number_to_fetch: usize) -> Option<usize>
Progresses the atomic counter by
number_to_fetch elements and returns the beginning index of the elements to be fetched.
Returns None if the iterator is terminated and there are no more elements to be fetched. Read moresource§fn get(&self, item_idx: usize) -> Option<T>
fn get(&self, item_idx: usize) -> Option<T>
Returns the
item_idx-th item that the iterator yields; returns None if the iterator completes before.source§impl<T: Send + Sync, Iter> ConcurrentIter for ConIterOfIter<T, Iter>where
Iter: Iterator<Item = T>,
impl<T: Send + Sync, Iter> ConcurrentIter for ConIterOfIter<T, Iter>where
Iter: Iterator<Item = T>,
§type BufferedIter = BufferIter<T, Iter>
type BufferedIter = BufferIter<T, Iter>
Type of the buffered iterator returned by the
chunk_iter method when elements are fetched in chunks by each thread.source§fn next_id_and_value(&self) -> Option<Next<Self::Item>>
fn next_id_and_value(&self) -> Option<Next<Self::Item>>
Advances the iterator and returns the next value together with its enumeration index. Read more
source§fn next_chunk(
&self,
chunk_size: usize
) -> Option<NextChunk<Self::Item, impl ExactSizeIterator<Item = Self::Item>>>
fn next_chunk( &self, chunk_size: usize ) -> Option<NextChunk<Self::Item, impl ExactSizeIterator<Item = Self::Item>>>
Advances the iterator
chunk_size times and returns an iterator of at most chunk_size consecutive next values.
Further, the beginning enumeration index of the yielded values is returned. Read moresource§fn buffered_iter(
&self,
chunk_size: usize
) -> BufferedIter<'_, Self::Item, Self::BufferedIter>
fn buffered_iter( &self, chunk_size: usize ) -> BufferedIter<'_, Self::Item, Self::BufferedIter>
Creates an iterator which pulls elements from this iterator as chunks of the given
chunk_size. Read moresource§fn try_get_len(&self) -> Option<usize>
fn try_get_len(&self) -> Option<usize>
Returns Some of the remaining length of the iterator if it is known; returns None otherwise.
source§fn next(&self) -> Option<Self::Item>
fn next(&self) -> Option<Self::Item>
Advances the iterator and returns the next value. Read more
source§fn values(&self) -> ConIterValues<'_, Self> ⓘwhere
Self: Sized,
fn values(&self) -> ConIterValues<'_, Self> ⓘwhere
Self: Sized,
Returns an
Iterator over the values of elements of the concurrent iterator. Read moresource§fn ids_and_values(&self) -> ConIterIdsAndValues<'_, Self> ⓘwhere
Self: Sized,
fn ids_and_values(&self) -> ConIterIdsAndValues<'_, Self> ⓘwhere
Self: Sized,
Returns an
Iterator over the ids and values of elements of the concurrent iterator. Read moresource§fn for_each<Fun: FnMut(Self::Item)>(&self, chunk_size: usize, fun: Fun)where
Self: Sized,
fn for_each<Fun: FnMut(Self::Item)>(&self, chunk_size: usize, fun: Fun)where
Self: Sized,
Applies the function
fun to each element of the iterator concurrently. Read moresource§impl<T: Send + Sync, Iter> From<Iter> for ConIterOfIter<T, Iter>where
Iter: Iterator<Item = T>,
impl<T: Send + Sync, Iter> From<Iter> for ConIterOfIter<T, Iter>where
Iter: Iterator<Item = T>,
impl<T: Send + Sync, Iter> Send for ConIterOfIter<T, Iter>where
Iter: Iterator<Item = T>,
impl<T: Send + Sync, Iter> Sync for ConIterOfIter<T, Iter>where
Iter: Iterator<Item = T>,
Auto Trait Implementations§
impl<T, Iter> !Freeze for ConIterOfIter<T, Iter>
impl<T, Iter> !RefUnwindSafe for ConIterOfIter<T, Iter>
impl<T, Iter> Unpin for ConIterOfIter<T, Iter>where
Iter: Unpin,
impl<T, Iter> UnwindSafe for ConIterOfIter<T, Iter>where
Iter: UnwindSafe,
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