Struct mutringbuf::iterators::sync_iterators::work_iter::WorkIter

source ·
pub struct WorkIter<B: MutRB> { /* private fields */ }
Expand description

Iterator used to mutate elements in-place.

This iterator returns mutable references to data stored within the buffer. Thuss 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 DetachedWorkIter can be obtained by calling Self::detach.

Implementations§

source§

impl<B: MutRB<Item = T>, T> WorkIter<B>

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>

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<'a>(&mut self) -> Option<&'a mut T>

Returns a mutable references to the current value.

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<'a>( &mut self, count: usize ) -> Option<WorkableSlice<'a, T>>

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

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<'a>(&mut self) -> Option<WorkableSlice<'a, T>>

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

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<'a>( &mut self, rhs: usize ) -> Option<WorkableSlice<'a, T>>

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

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 + IterManager> Drop for WorkIter<B>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<B: MutRB<Item = T>, T> MRBIterator<T> for WorkIter<B>

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<Item = T>, T> Send for WorkIter<B>

Auto Trait Implementations§

§

impl<B> Freeze for WorkIter<B>

§

impl<B> RefUnwindSafe for WorkIter<B>
where B: RefUnwindSafe,

§

impl<B> !Sync for WorkIter<B>

§

impl<B> Unpin for WorkIter<B>

§

impl<B> UnwindSafe for WorkIter<B>
where B: 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> 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.