pub type Cons<R> = Direct<R, false, true>;
Expand description
Consumer of a ring buffer.
Aliased Type§
struct Cons<R> { /* private fields */ }
Trait Implementations§
source§impl<R: RbRef> Consumer for Cons<R>
impl<R: RbRef> Consumer for Cons<R>
source§unsafe fn set_read_index(&self, value: usize)
unsafe fn set_read_index(&self, value: usize)
Set read index. Read more
source§unsafe fn advance_read_index(&self, count: usize)
unsafe fn advance_read_index(&self, count: usize)
source§fn occupied_slices(
&self,
) -> (&[MaybeUninit<Self::Item>], &[MaybeUninit<Self::Item>])
fn occupied_slices( &self, ) -> (&[MaybeUninit<Self::Item>], &[MaybeUninit<Self::Item>])
Provides a direct access to the ring buffer occupied memory.
The difference from
Self::as_slices
is that this method provides slices of MaybeUninit
, so items may be moved out of slices. Read moresource§unsafe fn occupied_slices_mut(
&mut self,
) -> (&mut [MaybeUninit<Self::Item>], &mut [MaybeUninit<Self::Item>])
unsafe fn occupied_slices_mut( &mut self, ) -> (&mut [MaybeUninit<Self::Item>], &mut [MaybeUninit<Self::Item>])
Provides a direct mutable access to the ring buffer occupied memory. Read more
source§fn as_slices(&self) -> (&[Self::Item], &[Self::Item])
fn as_slices(&self) -> (&[Self::Item], &[Self::Item])
Returns a pair of slices which contain, in order, the contents of the ring buffer.
source§fn as_mut_slices(&mut self) -> (&mut [Self::Item], &mut [Self::Item])
fn as_mut_slices(&mut self) -> (&mut [Self::Item], &mut [Self::Item])
Returns a pair of mutable slices which contain, in order, the contents of the ring buffer.
source§fn first(&self) -> Option<&Self::Item>
fn first(&self) -> Option<&Self::Item>
Returns a reference to the eldest item in the ring buffer, if exists.
source§fn first_mut(&mut self) -> Option<&mut Self::Item>
fn first_mut(&mut self) -> Option<&mut Self::Item>
Returns a mutable reference to the eldest item in the ring buffer, if exists.
source§fn last(&self) -> Option<&Self::Item>
fn last(&self) -> Option<&Self::Item>
Returns a reference to the most recent item in the ring buffer, if exists. Read more
source§fn last_mut(&mut self) -> Option<&mut Self::Item>
fn last_mut(&mut self) -> Option<&mut Self::Item>
Returns a mutable reference to the most recent item in the ring buffer, if exists. Read more
source§fn try_pop(&mut self) -> Option<Self::Item>
fn try_pop(&mut self) -> Option<Self::Item>
Removes the eldest item from the ring buffer and returns it. Read more
source§fn try_peek(&self) -> Option<&Self::Item>
fn try_peek(&self) -> Option<&Self::Item>
Returns the reference to the eldest item without removing it from the buffer. Read more
source§fn peek_slice_uninit(&self, elems: &mut [MaybeUninit<Self::Item>]) -> usize
fn peek_slice_uninit(&self, elems: &mut [MaybeUninit<Self::Item>]) -> usize
Copies items from the ring buffer to an uninit slice without removing them from the ring buffer. Read more
source§fn pop_slice_uninit(&mut self, elems: &mut [MaybeUninit<Self::Item>]) -> usize
fn pop_slice_uninit(&mut self, elems: &mut [MaybeUninit<Self::Item>]) -> usize
Removes items from the ring buffer and writes them into an uninit slice. Read more
source§fn pop_iter(&mut self) -> PopIter<'_, Self> ⓘ
fn pop_iter(&mut self) -> PopIter<'_, Self> ⓘ
Returns an iterator that removes items one by one from the ring buffer.
source§fn iter(&self) -> Iter<'_, Self>
fn iter(&self) -> Iter<'_, Self>
Returns a front-to-back iterator containing references to items in the ring buffer. Read more
source§fn iter_mut(&mut self) -> IterMut<'_, Self>
fn iter_mut(&mut self) -> IterMut<'_, Self>
Returns a front-to-back iterator that returns mutable references to items in the ring buffer. Read more
source§impl<R: RbRef> Read for Cons<R>
impl<R: RbRef> Read for Cons<R>
source§fn read(&mut self, buf: &mut [u8]) -> Result<usize>
fn read(&mut self, buf: &mut [u8]) -> Result<usize>
Pull some bytes from this source into the specified buffer, returning
how many bytes were read. Read more
1.36.0 · source§fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
Like
read
, except that it reads into a slice of buffers. Read moresource§fn is_read_vectored(&self) -> bool
fn is_read_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (
can_vector
)1.0.0 · source§fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
Read all bytes until EOF in this source, placing them into
buf
. Read more1.0.0 · source§fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
Read all bytes until EOF in this source, appending them to
buf
. Read more1.6.0 · source§fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
Read the exact number of bytes required to fill
buf
. Read moresource§fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>
fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>
🔬This is a nightly-only experimental API. (
read_buf
)Pull some bytes from this source into the specified buffer. Read more
source§fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>
fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>
🔬This is a nightly-only experimental API. (
read_buf
)Read the exact number of bytes required to fill
cursor
. Read more1.0.0 · source§fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
Creates a “by reference” adaptor for this instance of
Read
. Read more