Struct ConIterSlice

Source
pub struct ConIterSlice<'a, T>
where T: Send + Sync,
{ /* private fields */ }
Expand description

Concurrent iterator of a slice.

It can be created by calling into_con_iter on a slice.

Alternatively, it can be created calling con_iter on the type that owns the slice.

§Examples

use orx_concurrent_iter::*;

// &[T]: IntoConcurrentIter
let vec = vec![0, 1, 2, 3];
let slice = &vec[1..3];
let con_iter = slice.into_con_iter();
assert_eq!(con_iter.next(), Some(&1));
assert_eq!(con_iter.next(), Some(&2));
assert_eq!(con_iter.next(), None);

// Vec<T>: ConcurrentIterable
let vec = vec![1, 2];
let con_iter = vec.con_iter();
assert_eq!(con_iter.next(), Some(&1));
assert_eq!(con_iter.next(), Some(&2));
assert_eq!(con_iter.next(), None);

Trait Implementations§

Source§

impl<T> Clone for ConIterSlice<'_, T>
where T: Send + Sync,

Source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a, T> ConcurrentIter for ConIterSlice<'a, T>
where T: Send + Sync,

Source§

type Item = &'a T

Type of the element that the concurrent iterator yields.
Source§

type SequentialIter = Skip<Iter<'a, T>>

Type of the sequential iterator that the concurrent iterator can be converted into using the into_seq_iter method.
Source§

type ChunkPuller<'i> = ChunkPullerSlice<'i, 'a, T> where Self: 'i

Type of the chunk puller that can be created using the chunk_puller method.
Source§

fn into_seq_iter(self) -> Self::SequentialIter

Converts the concurrent iterator into its sequential regular counterpart. Note that the sequential iterator is a regular Iterator, and hence, does not have any overhead related with atomic states. Therefore, it is useful where the program decides to iterate over a single thread rather than concurrently by multiple threads. Read more
Source§

fn skip_to_end(&self)

Immediately jumps to the end of the iterator, skipping the remaining elements. Read more
Source§

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

Returns the next element of the iterator. It returns None if there are no more elements left. Read more
Source§

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

Returns the next element of the iterator together its index. It returns None if there are no more elements left. Read more
Source§

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

Returns the bounds on the remaining length of the iterator. Read more
Source§

fn chunk_puller(&self, chunk_size: usize) -> Self::ChunkPuller<'_>

Creates a ChunkPuller from the concurrent iterator. The created chunk puller can be used to pull chunk_size elements at once from the data source, rather than pulling one by one. Read more
Source§

fn try_get_len(&self) -> Option<usize>

Returns Some(x) if the number of remaining items is known with certainly and if it is equal to x. Read more
Source§

fn item_puller(&self) -> ItemPuller<'_, Self>
where Self: Sized,

Creates a ItemPuller from the concurrent iterator. The created item puller can be used to pull elements one by one from the data source. Read more
Source§

fn item_puller_with_idx(&self) -> EnumeratedItemPuller<'_, Self>
where Self: Sized,

Creates a EnumeratedItemPuller from the concurrent iterator. The created item puller can be used to pull elements one by one from the data source together with the index of the elements. Read more
Source§

fn copied<'a, T>(self) -> ConIterCopied<'a, Self, T>
where T: Send + Sync + Copy, Self: ConcurrentIter<Item = &'a T> + Sized,

Creates an iterator which copies all of its elements. Read more
Source§

fn cloned<'a, T>(self) -> ConIterCloned<'a, Self, T>
where T: Send + Sync + Clone, Self: ConcurrentIter<Item = &'a T> + Sized,

Creates an iterator which clones all of its elements. Read more
Source§

fn enumerate(self) -> Enumerate<Self>
where Self: Sized,

Creates an iterator which gives the current iteration count as well as the next value. Read more
Source§

impl<T> Debug for ConIterSlice<'_, T>
where T: Send + Sync,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> Default for ConIterSlice<'_, T>
where T: Send + Sync,

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T> ExactSizeConcurrentIter for ConIterSlice<'_, T>
where T: Send + Sync,

Source§

fn len(&self) -> usize

Returns the number remaining elements in the concurrent iterator. Read more
Source§

fn is_empty(&self) -> bool

Returns true if there are no elements left in the concurrent iterator. Returns false otherwise. Read more

Auto Trait Implementations§

§

impl<'a, T> !Freeze for ConIterSlice<'a, T>

§

impl<'a, T> RefUnwindSafe for ConIterSlice<'a, T>
where T: RefUnwindSafe,

§

impl<'a, T> Send for ConIterSlice<'a, T>

§

impl<'a, T> Sync for ConIterSlice<'a, T>

§

impl<'a, T> Unpin for ConIterSlice<'a, T>

§

impl<'a, T> UnwindSafe for ConIterSlice<'a, T>
where T: RefUnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.