Type Alias RxBuffer

Source
pub type RxBuffer = Buffer<Rx>;
Expand description

Alias for receive buffer.

Aliased Type§

struct RxBuffer { /* private fields */ }

Implementations

Source§

impl<K: AllocKind> Buffer<K>

Source

pub fn cap(&self) -> usize

Gets the capacity of the buffer in bytes as requested for allocation.

Source

pub fn len(&self) -> usize

Gets the length of the buffer which is actually used.

Source

pub fn write_at(&mut self, offset: usize, src: &[u8]) -> Result<()>

Writes bytes to the buffer.

Writes up to src.len() bytes into the buffer beginning at offset, returning how many bytes were written successfully. Partial write is not considered as an error.

Source

pub fn read_at(&self, offset: usize, dst: &mut [u8]) -> Result<()>

Reads bytes from the buffer.

Reads up to dst.len() bytes from the buffer beginning at offset, returning how many bytes were read successfully. Partial read is considered as an error.

Source

pub fn as_slice_mut(&mut self) -> Option<&mut [u8]>

Returns this buffer as a mutable slice if it’s not fragmented.

Source

pub fn frame_type(&self) -> Result<FrameType>

Retrieves the frame type of the buffer.

Source

pub fn port(&self) -> Port

Retrieves the buffer’s source port.

Source§

impl Buffer<Rx>

Source

pub async fn into_tx(self) -> Buffer<Tx>

Turns an rx buffer into a tx one.

Source

pub fn rx_flags(&self) -> Result<RxFlags>

Retrieves RxFlags of an Rx Buffer.

Trait Implementations

Source§

impl<K: AllocKind> Debug for Buffer<K>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<K: AllocKind> Read for Buffer<K>

Source§

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

Pull some bytes from this source into the specified buffer, returning how many bytes were read. Read more
1.36.0 · Source§

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

Like read, except that it reads into a slice of buffers. Read more
Source§

fn is_read_vectored(&self) -> bool

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

fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>

Reads all bytes until EOF in this source, placing them into buf. Read more
1.0.0 · Source§

fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>

Reads all bytes until EOF in this source, appending them to buf. Read more
1.6.0 · Source§

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

Reads the exact number of bytes required to fill buf. Read more
Source§

fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>

🔬This is a nightly-only experimental API. (read_buf)
Pull some bytes from this source into the specified buffer. Read more
Source§

fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>

🔬This is a nightly-only experimental API. (read_buf)
Reads the exact number of bytes required to fill cursor. Read more
1.0.0 · Source§

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

Creates a “by reference” adaptor for this instance of Read. Read more
1.0.0 · Source§

fn bytes(self) -> Bytes<Self>
where Self: Sized,

Transforms this Read instance to an Iterator over its bytes. Read more
1.0.0 · Source§

fn chain<R>(self, next: R) -> Chain<Self, R>
where R: Read, Self: Sized,

Creates an adapter which will chain this stream with another. Read more
1.0.0 · Source§

fn take(self, limit: u64) -> Take<Self>
where Self: Sized,

Creates an adapter which will read at most limit bytes from it. Read more
Source§

impl<K: AllocKind> Seek for Buffer<K>

Source§

fn seek(&mut self, pos: SeekFrom) -> Result<u64>

Seek to an offset, in bytes, in a stream. Read more
1.55.0 · Source§

fn rewind(&mut self) -> Result<(), Error>

Rewind to the beginning of a stream. Read more
Source§

fn stream_len(&mut self) -> Result<u64, Error>

🔬This is a nightly-only experimental API. (seek_stream_len)
Returns the length of this stream (in bytes). Read more
1.51.0 · Source§

fn stream_position(&mut self) -> Result<u64, Error>

Returns the current seek position from the start of the stream. Read more
1.80.0 · Source§

fn seek_relative(&mut self, offset: i64) -> Result<(), Error>

Seeks relative to the current position. Read more