pub struct WorkIter<'buf, B: MutRB> { /* 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 Detached can be obtained by calling Self::detach.
Implementations§
Trait Implementations§
Source§impl<'buf, B: MutRB<Item = T>, T> MRBIterator for WorkIter<'buf, B>
impl<'buf, B: MutRB<Item = T>, T> MRBIterator for WorkIter<'buf, B>
type Item = T
Source§fn is_prod_alive(&self) -> bool
fn is_prod_alive(&self) -> bool
Returns
true if the producer iterator is still alive, false if it has been dropped.Source§fn is_work_alive(&self) -> bool
fn is_work_alive(&self) -> bool
Returns
true if the worker iterator is still alive, false if it has been dropped.Source§fn is_cons_alive(&self) -> bool
fn is_cons_alive(&self) -> bool
Returns
true if the consumer iterator is still alive, false if it has been dropped.Source§fn prod_index(&self) -> usize
fn prod_index(&self) -> usize
Returns the index of the producer.
Source§fn work_index(&self) -> usize
fn work_index(&self) -> usize
Returns the index of the worker.
Source§fn cons_index(&self) -> usize
fn cons_index(&self) -> usize
Returns the index of the consumer.
Source§fn detach(self) -> Detached<Self>where
Self: Sized,
fn detach(self) -> Detached<Self>where
Self: Sized,
Detaches the iterator yielding a
Detached.Source§fn wait_for(&mut self, count: usize)
fn wait_for(&mut self, count: usize)
Waits, blocking the thread in a loop, until there are at least
count available items.Source§fn get_workable<'a>(&mut self) -> Option<&'a mut Self::Item>
fn get_workable<'a>(&mut self) -> Option<&'a mut Self::Item>
Returns a mutable references to the current value. Read more
Source§fn get_workable_slice_exact<'a>(
&mut self,
count: usize,
) -> Option<(&'a mut [<Self as MRBIterator>::Item], &'a mut [<Self as MRBIterator>::Item])>
fn get_workable_slice_exact<'a>( &mut self, count: usize, ) -> Option<(&'a mut [<Self as MRBIterator>::Item], &'a mut [<Self as MRBIterator>::Item])>
Returns a tuple of mutable slice references, the sum of which with len equal to
count. Read moreSource§fn get_workable_slice_avail<'a>(
&mut self,
) -> Option<(&'a mut [<Self as MRBIterator>::Item], &'a mut [<Self as MRBIterator>::Item])>
fn get_workable_slice_avail<'a>( &mut self, ) -> Option<(&'a mut [<Self as MRBIterator>::Item], &'a mut [<Self as MRBIterator>::Item])>
Returns a tuple of mutable slice references, the sum of which with len equal to
Self::available(). Read moreSource§fn get_workable_slice_multiple_of<'a>(
&mut self,
rhs: usize,
) -> Option<(&'a mut [<Self as MRBIterator>::Item], &'a mut [<Self as MRBIterator>::Item])>
fn get_workable_slice_multiple_of<'a>( &mut self, rhs: usize, ) -> Option<(&'a mut [<Self as MRBIterator>::Item], &'a mut [<Self as MRBIterator>::Item])>
Returns a tuple of mutable slice references, the sum of which with len equal to the
higher multiple of
rhs. Read moreimpl<'buf, B: ConcurrentRB + MutRB<Item = T>, T> Send for WorkIter<'buf, B>
Auto Trait Implementations§
impl<'buf, B> Freeze for WorkIter<'buf, B>
impl<'buf, B> RefUnwindSafe for WorkIter<'buf, B>where
B: RefUnwindSafe,
impl<'buf, B> !Sync for WorkIter<'buf, B>
impl<'buf, B> Unpin for WorkIter<'buf, B>
impl<'buf, B> UnwindSafe for WorkIter<'buf, B>where
B: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more