Struct ringbuf::wrap::direct::Direct

source ·
pub struct Direct<R: RbRef, const P: bool, const C: bool> { /* private fields */ }
Expand description

Direct wrapper of a ring buffer.

Implementations§

source§

impl<R: RbRef, const P: bool, const C: bool> Direct<R, P, C>

source

pub fn new(rb: R) -> Self

Create a new ring buffer direct wrapper.

Panics if wrapper with matching rights already exists.

source

pub fn observe(&self) -> Obs<R>

Get ring buffer observer.

source

pub fn freeze(self) -> Frozen<R, P, C>

Freeze current state.

Trait Implementations§

source§

impl<R: RbRef, const P: bool, const C: bool> AsMut<Direct<R, P, C>> for Direct<R, P, C>

source§

fn as_mut(&mut self) -> &mut Self

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl<R: RbRef, const P: bool, const C: bool> AsRef<Direct<R, P, C>> for Direct<R, P, C>

source§

fn as_ref(&self) -> &Self

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<R: RbRef, const P: bool, const C: bool> Drop for Direct<R, P, C>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<R: RbRef, const P: bool, const C: bool> Observer for Direct<R, P, C>

§

type Item = <<R as RbRef>::Rb as Observer>::Item

source§

fn capacity(&self) -> NonZeroUsize

Capacity of the ring buffer. Read more
source§

fn read_index(&self) -> usize

Index of the last item in the ring buffer. Read more
source§

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<Self::Item>], &[MaybeUninit<Self::Item>])

Get slice between start and end indices. Read more
source§

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

Get mutable slice between start and end indices. Read more
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<R: RbRef, const P: bool, const C: bool> Wrap for Direct<R, P, C>

§

type RbRef = R

Ring buffer reference type.
source§

fn rb_ref(&self) -> &R

Underlying ring buffer reference.
source§

fn into_rb_ref(self) -> R

Destructure into underlying ring buffer reference.
source§

fn rb(&self) -> &<Self::RbRef as RbRef>::Rb

Underlying ring buffer.

Auto Trait Implementations§

§

impl<R, const P: bool, const C: bool> Freeze for Direct<R, P, C>
where R: Freeze,

§

impl<R, const P: bool, const C: bool> RefUnwindSafe for Direct<R, P, C>
where R: RefUnwindSafe,

§

impl<R, const P: bool, const C: bool> Send for Direct<R, P, C>
where R: Send,

§

impl<R, const P: bool, const C: bool> Sync for Direct<R, P, C>
where R: Sync,

§

impl<R, const P: bool, const C: bool> Unpin for Direct<R, P, C>
where R: Unpin,

§

impl<R, const P: bool, const C: bool> UnwindSafe for Direct<R, P, C>
where R: UnwindSafe,

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where 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 T
where 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.