pub struct DmaRxStreamBufView { /* private fields */ }Available on crate feature
unstable only.Expand description
A view into a DmaRxStreamBuf.
Implementations§
Source§impl DmaRxStreamBufView
impl DmaRxStreamBufView
Sourcepub fn available_bytes(&mut self) -> usize
pub fn available_bytes(&mut 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(&mut self) -> &[u8]
pub fn peek(&mut 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.
Ignores EOFs. See Self::peek_until_eof for EOF support.
Sourcepub fn peek_until_eof(&mut self) -> (&[u8], bool)
pub fn peek_until_eof(&mut 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.
Auto Trait Implementations§
impl !Sync for DmaRxStreamBufView
impl !UnwindSafe for DmaRxStreamBufView
impl Freeze for DmaRxStreamBufView
impl RefUnwindSafe for DmaRxStreamBufView
impl Send for DmaRxStreamBufView
impl Unpin for DmaRxStreamBufView
impl UnsafeUnpin for DmaRxStreamBufView
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more