Struct mutringbuf::iterators::impls::detached_work_iter::DetachedWorkIter
source · pub struct DetachedWorkIter<B: MutRB<T>, T, A> { /* private fields */ }Expand description
Same as WorkIter, but does not update the atomic index when advancing.
This makes it possible to explore available data back and forth, putting the consumer iterator on hold.
A typical use case of this structure is to search something amidst produced data, aligning the detached iterator to a suitable index, and then returning to a normal worker iterator.
This struct can only be created by detaching a worker iterator.
When done, a worker iterator can be re-obtained via Self::attach.
Note that, in order to avoid buffer saturation, atomic index can be synced with Self::sync_index;
this synchronises indices making the consumer iterator able to move on.
As WorkIter, this iterator returns mutable references to data stored within the buffer.
Thus, as stated in the docs written for the former, Self::advance has to be called when done with the mutation
in order to move the iterator.
Implementations§
source§impl<B: MutRB<T>, T, A> DetachedWorkIter<B, T, A>
impl<B: MutRB<T>, T, A> DetachedWorkIter<B, T, A>
sourcepub fn available(&mut self) -> usize
pub fn available(&mut self) -> usize
See WorkIter::available.
sourcepub fn index(&self) -> usize
pub fn index(&self) -> usize
See WorkIter::index.
sourcepub fn buf_len(&self) -> usize
pub fn buf_len(&self) -> usize
See WorkIter::buf_len.
sourcepub unsafe fn advance(&mut self, count: usize)
pub unsafe fn advance(&mut self, count: usize)
Advances the iterator as in WorkIter::available(), but does not modify the atomic counter,
making the change local.
§Safety
See WorkIter::advance.
source§impl<B: MutRB<T>, T, A> DetachedWorkIter<B, T, A>
impl<B: MutRB<T>, T, A> DetachedWorkIter<B, T, A>
sourcepub fn is_prod_alive(&self) -> bool
pub fn is_prod_alive(&self) -> bool
sourcepub fn is_cons_alive(&self) -> bool
pub fn is_cons_alive(&self) -> bool
sourcepub fn sync_index(&self)
pub fn sync_index(&self)
Synchronises the underlying atomic index with the local index. I.e. let the consumer iterator advance.