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>
impl<B: MutRB<Item = T>, T> WorkIter<B>
sourcepub fn is_prod_alive(&self) -> bool
pub fn is_prod_alive(&self) -> bool
Returns true
if the producer iterator is still alive, false
if it has been dropped.
sourcepub fn is_cons_alive(&self) -> bool
pub fn is_cons_alive(&self) -> bool
Returns true
if the consumer iterator is still alive, false
if it has been dropped.
sourcepub fn detach(self) -> DetachedWorkIter<B>
pub fn detach(self) -> DetachedWorkIter<B>
Detaches the iterator yielding a DetachedWorkIter
.
sourcepub fn reset_index(&mut self)
pub fn reset_index(&mut self)
Resets the index of the iterator. I.e., moves the iterator to the location occupied by its successor.
sourcepub fn get_workable<'a>(&mut self) -> Option<&'a mut T>
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.
sourcepub fn get_workable_slice_exact<'a>(
&mut self,
count: usize
) -> Option<WorkableSlice<'a, T>>
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.
sourcepub fn get_workable_slice_avail<'a>(&mut self) -> Option<WorkableSlice<'a, T>>
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.
sourcepub fn get_workable_slice_multiple_of<'a>(
&mut self,
rhs: usize
) -> Option<WorkableSlice<'a, T>>
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.