Type Alias FrozenProd

Source
pub type FrozenProd<R> = Frozen<R, true, false>;
Expand description

Frozen write end of some ring buffer.

Inserted items is not visible for an opposite write end until Self::commit/Self::sync is called or Self is dropped. A free space of items removed by an opposite write end is not visible for Self until Self::sync is called.

Aliased Type§

struct FrozenProd<R> { /* private fields */ }

Implementations§

Source§

impl<R: RbRef> FrozenProd<R>

Source

pub fn discard(&mut self)

Discard new items pushed since last sync.

Source§

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

Source

pub fn commit(&self)

Commit changes to the ring buffer.

Source

pub fn fetch(&self)

Fetch changes from the ring buffer.

Source

pub fn sync(&self)

Commit changes to and fetch updates from the ring buffer.

Source§

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

Source

pub fn new(rb: R) -> Self

Create a new ring buffer frozen wrapper.

Panics if wrapper with matching rights already exists.

Source

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

Get ring buffer observer.

Trait Implementations§

Source§

impl<R: RbRef> Producer for FrozenProd<R>

Source§

unsafe fn set_write_index(&self, value: usize)

Set read index. Read more
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: Iterator<Item = Self::Item>>(&mut self, iter: I) -> usize

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§

fn push_slice(&mut self, elems: &[Self::Item]) -> usize
where Self::Item: Copy,

Appends items from slice to the ring buffer. Read more
Source§

fn read_from<S: Read>( &mut self, reader: &mut S, count: Option<usize>, ) -> Option<Result<usize>>
where Self: Producer<Item = u8>,

Reads at most count bytes from Read instance and appends them to the ring buffer. If count is None then as much as possible bytes will be read. Read more
Source§

impl<R: RbRef> Write for FrozenProd<R>
where Self: Producer<Item = u8>,

Source§

fn write(&mut self, buf: &[u8]) -> Result<usize>

Writes a buffer into this writer, returning how many bytes were written. Read more
Source§

fn flush(&mut self) -> Result<()>

Flushes this output stream, ensuring that all intermediately buffered contents reach their destination. Read more
1.36.0 · Source§

fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> Result<usize, Error>

Like write, except that it writes from a slice of buffers. Read more
Source§

fn is_write_vectored(&self) -> bool

🔬This is a nightly-only experimental API. (can_vector)
Determines if this Writer has an efficient write_vectored implementation. Read more
1.0.0 · Source§

fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>

Attempts to write an entire buffer into this writer. Read more
Source§

fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>

🔬This is a nightly-only experimental API. (write_all_vectored)
Attempts to write multiple buffers into this writer. Read more
1.0.0 · Source§

fn write_fmt(&mut self, args: Arguments<'_>) -> Result<(), Error>

Writes a formatted string into this writer, returning any error encountered. Read more
1.0.0 · Source§

fn by_ref(&mut self) -> &mut Self
where Self: Sized,

Creates a “by reference” adapter for this instance of Write. Read more
Source§

impl<R: RbRef> Write for FrozenProd<R>
where Self: Producer<Item = u8>,

Source§

fn write_str(&mut self, s: &str) -> Result

Writes a string slice into this writer, returning whether the write succeeded. Read more
1.1.0 · Source§

fn write_char(&mut self, c: char) -> Result<(), Error>

Writes a char into this writer, returning whether the write succeeded. Read more
1.0.0 · Source§

fn write_fmt(&mut self, args: Arguments<'_>) -> Result<(), Error>

Glue for usage of the write! macro with implementors of this trait. Read more
Source§

impl<R: RbRef, const P: bool, const C: bool> AsMut<Frozen<R, P, C>> for Frozen<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<Frozen<R, P, C>> for Frozen<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 Frozen<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 Frozen<R, P, C>

Source§

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 Frozen<R, P, C>

Source§

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.