Struct DmaRxStreamBufView

Source
pub struct DmaRxStreamBufView { /* private fields */ }
Available on crate feature unstable only.
Expand description

A view into a DmaRxStreamBuf

Implementations§

Source§

impl DmaRxStreamBufView

Source

pub fn available_bytes(&self) -> usize

Returns the number of bytes that are available to read from the buf.

Source

pub fn pop(&mut self, buf: &mut [u8]) -> usize

Reads as much as possible into the buf from the available data.

Source

pub fn peek(&self) -> &[u8]

Returns a slice into the buffer containing available data. This will be the longest possible contiguous slice into the buffer that contains data that is available to read.

Note: This function ignores EOFs, see Self::peek_until_eof if you need EOF support.

Source

pub fn peek_until_eof(&self) -> (&[u8], bool)

Same as Self::peek but will not skip over any EOFs.

It also returns a boolean indicating whether this slice ends with an EOF or not.

Source

pub fn consume(&mut self, n: usize) -> usize

Consumes the first n bytes from the available data, returning any fully consumed descriptors back to the DMA. This is typically called after Self::peek/Self::peek_until_eof.

Returns the number of bytes that were actually consumed.

Auto Trait Implementations§

§

impl Freeze for DmaRxStreamBufView

§

impl RefUnwindSafe for DmaRxStreamBufView

§

impl Send for DmaRxStreamBufView

§

impl !Sync for DmaRxStreamBufView

§

impl Unpin for DmaRxStreamBufView

§

impl !UnwindSafe for DmaRxStreamBufView

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

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

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.