Struct async_ringbuf::rb::AsyncRb
source · pub struct AsyncRb<S: Storage> { /* private fields */ }
Implementations§
Trait Implementations§
source§impl<S: Storage> Consumer for AsyncRb<S>
impl<S: Storage> Consumer for AsyncRb<S>
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 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) -> Chain<Iter<'_, Self::Item>, Iter<'_, Self::Item>>
fn iter(&self) -> Chain<Iter<'_, Self::Item>, Iter<'_, Self::Item>>
Returns a front-to-back iterator containing references to items in the ring buffer. Read more
source§fn iter_mut(
&mut self
) -> Chain<IterMut<'_, Self::Item>, IterMut<'_, Self::Item>>
fn iter_mut( &mut self ) -> Chain<IterMut<'_, Self::Item>, IterMut<'_, Self::Item>>
Returns a front-to-back iterator that returns mutable references to items in the ring buffer. Read more
source§impl<S: Storage> Observer for AsyncRb<S>
impl<S: Storage> Observer for AsyncRb<S>
type Item = <S as Storage>::Item
source§fn capacity(&self) -> NonZeroUsize
fn capacity(&self) -> NonZeroUsize
Capacity of the ring buffer. Read more
source§fn read_index(&self) -> usize
fn read_index(&self) -> usize
Index of the last item in the ring buffer. Read more
source§fn write_index(&self) -> usize
fn write_index(&self) -> usize
Index of the next empty slot in the ring buffer. Read more
source§unsafe fn unsafe_slices(
&self,
start: usize,
end: usize
) -> (&[MaybeUninit<S::Item>], &[MaybeUninit<S::Item>])
unsafe fn unsafe_slices( &self, start: usize, end: usize ) -> (&[MaybeUninit<S::Item>], &[MaybeUninit<S::Item>])
source§unsafe fn unsafe_slices_mut(
&self,
start: usize,
end: usize
) -> (&mut [MaybeUninit<S::Item>], &mut [MaybeUninit<S::Item>])
unsafe fn unsafe_slices_mut( &self, start: usize, end: usize ) -> (&mut [MaybeUninit<S::Item>], &mut [MaybeUninit<S::Item>])
source§fn read_is_held(&self) -> bool
fn read_is_held(&self) -> bool
Whether read end is held by consumer.
source§fn write_is_held(&self) -> bool
fn write_is_held(&self) -> bool
Whether write end is held by producer.
source§fn occupied_len(&self) -> usize
fn occupied_len(&self) -> usize
The number of items stored in the buffer. Read more
source§fn vacant_len(&self) -> usize
fn vacant_len(&self) -> usize
The number of remaining free places in the buffer. Read more
source§impl<S: Storage> Producer for AsyncRb<S>
impl<S: Storage> Producer for AsyncRb<S>
source§unsafe fn set_write_index(&self, value: usize)
unsafe fn set_write_index(&self, value: usize)
Set read index. Read more
source§unsafe fn advance_write_index(&self, count: usize)
unsafe fn advance_write_index(&self, count: usize)
source§fn vacant_slices(
&self
) -> (&[MaybeUninit<Self::Item>], &[MaybeUninit<Self::Item>])
fn vacant_slices( &self ) -> (&[MaybeUninit<Self::Item>], &[MaybeUninit<Self::Item>])
Provides a direct access to the ring buffer vacant memory. Read more
source§fn vacant_slices_mut(
&mut self
) -> (&mut [MaybeUninit<Self::Item>], &mut [MaybeUninit<Self::Item>])
fn vacant_slices_mut( &mut self ) -> (&mut [MaybeUninit<Self::Item>], &mut [MaybeUninit<Self::Item>])
Mutable version of
Self::vacant_slices
. Read moresource§impl<S: Storage> RingBuffer for AsyncRb<S>
impl<S: Storage> RingBuffer for AsyncRb<S>
source§unsafe fn hold_read(&self, flag: bool) -> bool
unsafe fn hold_read(&self, flag: bool) -> bool
Tell whether read end of the ring buffer is held by consumer or not. Read more
source§unsafe fn hold_write(&self, flag: bool) -> bool
unsafe fn hold_write(&self, flag: bool) -> bool
Tell whether write end of the ring buffer is held by producer or not. Read more
impl<S: Storage> Unpin for AsyncRb<S>
Auto Trait Implementations§
impl<S> !Freeze for AsyncRb<S>
impl<S> !RefUnwindSafe for AsyncRb<S>
impl<S> Send for AsyncRb<S>where
S: Send,
impl<S> Sync for AsyncRb<S>where
S: Sync,
impl<S> UnwindSafe for AsyncRb<S>where
S: UnwindSafe,
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