ringbuf::wrap::direct

Type Alias Prod

Source
pub type Prod<R> = Direct<R, true, false>;
Expand description

Producer of a ring buffer.

Aliased Type§

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

Trait Implementations§

Source§

impl<R: RbRef> Producer for Prod<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 Prod<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, fmt: 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 Prod<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