Struct async_ringbuf::rb::AsyncRb

source ·
pub struct AsyncRb<S: Storage> { /* private fields */ }

Implementations§

source§

impl<T> AsyncRb<Vec<MaybeUninit<T>, Global>>

source

pub fn new(cap: usize) -> Self

source§

impl<S: Storage> AsyncRb<S>

source

pub fn from(base: SharedRb<S>) -> Self

Trait Implementations§

source§

impl<S: Storage> Consumer for AsyncRb<S>

source§

unsafe fn set_read_index(&self, value: usize)

source§

unsafe fn advance_read_index(&self, count: usize)

Moves read pointer by count places forward. Read more
source§

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

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

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

Returns a pair of mutable slices which contain, in order, the contents of the ring buffer.
source§

fn try_pop(&mut self) -> Option<Self::Item>

Removes latest item from the ring buffer and returns it. Read more
source§

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

Returns a front-to-back iterator that returns mutable references to items in the ring buffer. Read more
source§

fn skip(&mut self, count: usize) -> usize

Removes at most count and at least min(count, Self::len()) items from the buffer and safely drops them. Read more
source§

fn clear(&mut self) -> usize

Removes all items from the buffer and safely drops them. Read more
source§

impl<T, const N: usize> Default for AsyncRb<Static<T, N>>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<S: Storage> Observer for AsyncRb<S>

§

type Item = <S as Storage>::Item

source§

fn capacity(&self) -> NonZeroUsize

Capacity of the ring buffer. Read more
source§

fn read_index(&self) -> usize

source§

fn write_index(&self) -> usize

source§

unsafe fn unsafe_slices( &self, start: usize, end: usize ) -> (&mut [MaybeUninit<S::Item>], &mut [MaybeUninit<S::Item>])

source§

fn read_is_held(&self) -> bool

Whether read end is held by consumer.
source§

fn write_is_held(&self) -> bool

Whether write end is held by producer.
source§

fn occupied_len(&self) -> usize

The number of items stored in the buffer. Read more
source§

fn vacant_len(&self) -> usize

The number of remaining free places in the buffer. Read more
source§

fn is_empty(&self) -> bool

Checks if the ring buffer is empty. Read more
source§

fn is_full(&self) -> bool

Checks if the ring buffer is full. Read more
source§

impl<S: Storage> Producer for AsyncRb<S>

source§

unsafe fn set_write_index(&self, value: usize)

source§

unsafe fn advance_write_index(&self, count: usize)

Moves write pointer by count places forward. Read more
source§

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

Mutable version of Self::vacant_slices. Read more
source§

fn try_push(&mut self, elem: Self::Item) -> Result<(), Self::Item>

Appends an item to the ring buffer. Read more
source§

fn push_iter<I>(&mut self, iter: I) -> usizewhere I: Iterator<Item = Self::Item>,

Appends items from an iterator to the ring buffer. Elements that haven’t been added to the ring buffer remain in the iterator. Read more
source§

impl<S: Storage> RingBuffer for AsyncRb<S>

source§

unsafe fn hold_read(&self, flag: bool)

source§

unsafe fn hold_write(&self, flag: bool)

source§

fn push_overwrite(&mut self, elem: Self::Item) -> Option<Self::Item>

Pushes an item to the ring buffer overwriting the latest item if the buffer is full. Read more
source§

fn push_iter_overwrite<I>(&mut self, iter: I)where I: Iterator<Item = Self::Item>,

Appends items from an iterator to the ring buffer. Read more
source§

impl<S: Storage> Split for AsyncRb<S>

§

type Prod = AsyncWrap<Arc<AsyncRb<S>, Global>, true, false>

§

type Cons = AsyncWrap<Arc<AsyncRb<S>, Global>, false, true>

source§

fn split(self) -> (Self::Prod, Self::Cons)

source§

impl<S: Storage> SplitRef for AsyncRb<S>

§

type RefProd<'a> = AsyncWrap<&'a AsyncRb<S>, true, false> where Self: 'a

§

type RefCons<'a> = AsyncWrap<&'a AsyncRb<S>, false, true> where Self: 'a

source§

fn split_ref(&mut self) -> (Self::RefProd<'_>, Self::RefCons<'_>)

source§

impl<S: Storage> Unpin for AsyncRb<S>

Auto Trait Implementations§

§

impl<S> !RefUnwindSafe for AsyncRb<S>

§

impl<S> Send for AsyncRb<S>where <S as Storage>::Internal: Send,

§

impl<S> Sync for AsyncRb<S>where <S as Storage>::Item: Send,

§

impl<S> UnwindSafe for AsyncRb<S>where <S as Storage>::Internal: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.