pub struct WorkIter<B: MutRB<T>, T, A> { /* private fields */ }
Expand description

Iterator used to mutate elements in-place.

This iterator returns mutable references to data stored within the buffer. Thus, as stated in the docs below, Self::advance has to be called when done with the mutation in order to move the iterator.

Self::advance updates a global iterator, which is read by the consumer to decide if it can move on. To avoid this, a DetachedWorkIter can be obtained by calling Self::detach.

Implementations§

source§

impl<B: MutRB<T>, T, A> WorkIter<B, T, A>

source

pub fn is_prod_alive(&self) -> bool

Returns true if the producer iterator is still alive, false if it has been dropped.

source

pub fn is_cons_alive(&self) -> bool

Returns true if the consumer iterator is still alive, false if it has been dropped.

source

pub fn detach(self) -> DetachedWorkIter<B, T, A>

Detaches the iterator yielding a DetachedWorkIter.

source

pub fn reset_index(&mut self)

Resets the index of the iterator. I.e., moves the iterator to the location occupied by its successor.

source

pub fn get_workable(&mut self) -> Option<(&mut T, &mut A)>

Returns a tuple containing mutable references to actual value and accumulator.

Being these references, Self::advance() has to be called when done with the mutation in order to move the iterator.

source

pub fn get_workable_slice_exact( &mut self, count: usize ) -> Option<WorkableSlice<'_, T, A>>

Returns a tuple of mutable slice references, the sum of which with len equal to count, along with accumulator.

Being these references, Self::advance() has to be called when done with the mutation in order to move the iterator.

source

pub fn get_workable_slice_avail(&mut self) -> Option<WorkableSlice<'_, T, A>>

Returns a tuple of mutable slice references, the sum of which with len equal to Self::available(), along with accumulator.

Being these references, Self::advance() has to be called when done with the mutation in order to move the iterator.

source

pub fn get_workable_slice_multiple_of( &mut self, rhs: usize ) -> Option<WorkableSlice<'_, T, A>>

Returns a tuple of mutable slice references, the sum of which with len equal to the maximum multiple of modulo, along with accumulator.

Being these references, Self::advance() has to be called when done with the mutation in order to move the iterator.

Trait Implementations§

source§

impl<B: MutRB<T> + IterManager, T, A> Drop for WorkIter<B, T, A>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<B: MutRB<T>, T, A> MRBIterator<T> for WorkIter<B, T, A>

source§

fn available(&mut self) -> usize

Returns the number of items available for an iterator.
source§

unsafe fn advance(&mut self, count: usize)

Advances the iterator by count. Read more
source§

fn index(&self) -> usize

Returns the index of the iterator.
source§

fn buf_len(&self) -> usize

Returns the length of the buffer.
source§

impl<B: ConcurrentRB + MutRB<T>, T, A> Send for WorkIter<B, T, A>

Auto Trait Implementations§

§

impl<B, T, A> !Freeze for WorkIter<B, T, A>

§

impl<B, T, A> !RefUnwindSafe for WorkIter<B, T, A>

§

impl<B, T, A> !Sync for WorkIter<B, T, A>

§

impl<B, T, A> Unpin for WorkIter<B, T, A>
where A: Unpin, T: Unpin,

§

impl<B, T, A> UnwindSafe for WorkIter<B, T, A>

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>,

§

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>,

§

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.