Struct mutringbuf::iterators::sync_iterators::cons_iter::ConsIter
source · pub struct ConsIter<B: MutRB, const W: bool> { /* private fields */ }
Expand description
Implementations§
source§impl<B: MutRB<Item = T>, T, const W: bool> ConsIter<B, W>
impl<B: MutRB<Item = T>, T, const W: bool> ConsIter<B, W>
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_work_alive(&self) -> bool
pub fn is_work_alive(&self) -> bool
Returns true
if the worker iterator is still alive, false
if it has been dropped.
Note: when the buffer is used in non-mutable mode this will always return false
.
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 peek_ref<'a>(&mut self) -> Option<&'a T>
pub fn peek_ref<'a>(&mut self) -> Option<&'a T>
Returns a reference to an element.
Being this a reference, Self::advance()
has to be called when done with the data
in order to move the iterator.
sourcepub fn peek_slice<'a>(&mut self, count: usize) -> Option<(&'a [T], &'a [T])>
pub fn peek_slice<'a>(&mut self, count: usize) -> Option<(&'a [T], &'a [T])>
Returns a tuple of slice references, the sum of which with len equal to count
.
Being these references, Self::advance()
has to be called when done with the data
in order to move the iterator.
sourcepub fn peek_available<'a>(&mut self) -> Option<(&'a [T], &'a [T])>
pub fn peek_available<'a>(&mut self) -> Option<(&'a [T], &'a [T])>
Returns a tuple of slice references, the sum of which with len equal to available data.
Being these references, Self::advance()
has to be called when done with the data
in order to move the iterator.
sourcepub fn copy_item(&mut self, dst: &mut T) -> Option<()>where
T: Copy,
pub fn copy_item(&mut self, dst: &mut T) -> Option<()>where
T: Copy,
- Returns
Some(())
, copying next item intodst
, if available. - Returns
None
doing nothing, otherwise.
This method uses copy
and should be preferred over clone
version, if possible.
Unlike peek*
methods, this one automatically advances the iterator.
sourcepub fn clone_item(&mut self, dst: &mut T) -> Option<()>where
T: Clone,
pub fn clone_item(&mut self, dst: &mut T) -> Option<()>where
T: Clone,
Same as Self::copy_item
, but uses clone
, instead.
Unlike peek*
methods, this one automatically advances the iterator.
sourcepub fn copy_slice(&mut self, dst: &mut [T]) -> Option<()>where
T: Copy,
pub fn copy_slice(&mut self, dst: &mut [T]) -> Option<()>where
T: Copy,
- Returns
Some(())
, fillingdst
slice with the nextdst.len()
values, if available. - Returns
None
doing nothing, otherwise.
This method fills the slice using copy
and should be preferred over clone
version, if possible.
Unlike peek*
methods, this one automatically advances the iterator.
sourcepub fn clone_slice(&mut self, dst: &mut [T]) -> Option<()>where
T: Clone,
pub fn clone_slice(&mut self, dst: &mut [T]) -> Option<()>where
T: Clone,
Same as Self::copy_slice
, but uses clone
, instead.
Unlike peek*
methods, this one automatically advances the iterator.