pub struct DmaRxStreamBufView { /* private fields */ }
unstable
only.Expand description
A view into a DmaRxStreamBuf
Implementations§
Source§impl DmaRxStreamBufView
impl DmaRxStreamBufView
Sourcepub fn available_bytes(&self) -> usize
pub fn available_bytes(&self) -> usize
Returns the number of bytes that are available to read from the buf.
Sourcepub fn pop(&mut self, buf: &mut [u8]) -> usize
pub fn pop(&mut self, buf: &mut [u8]) -> usize
Reads as much as possible into the buf from the available data.
Sourcepub fn peek(&self) -> &[u8]
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.
Sourcepub fn peek_until_eof(&self) -> (&[u8], bool)
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.
Sourcepub fn consume(&mut self, n: usize) -> usize
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.