mutringbuf::iterators::sync_iterators::work_iter

Struct WorkIter

Source
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§

Source§

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

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.

Trait Implementations§

Source§

impl<'buf, B: MutRB + IterManager> Drop for WorkIter<'buf, B>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

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

Source§

type Item = T

Source§

fn available(&mut self) -> usize

Returns the number of items available for an iterator.
Source§

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

Returns true if the worker iterator is still alive, false if it has been dropped.
Source§

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

Returns the index of the producer.
Source§

fn work_index(&self) -> usize

Returns the index of the worker.
Source§

fn cons_index(&self) -> usize

Returns the index of the consumer.
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 set_index(&mut self, index: usize)

Sets the local index.
Source§

fn buf_len(&self) -> usize

Returns the length of the buffer.
Source§

fn detach(self) -> Detached<Self>
where Self: Sized,

Detaches the iterator yielding a Detached.
Source§

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>

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])>

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

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 more
Source§

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 more
Source§

impl<'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> 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>,

Source§

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>,

Source§

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.