Struct embassy_hal_internal::atomic_ring_buffer::Reader
source · pub struct Reader<'a>(/* private fields */);
Expand description
A type which can only read from a ring buffer.
Implementations§
source§impl<'a> Reader<'a>
impl<'a> Reader<'a>
sourcepub fn pop(&mut self, f: impl FnOnce(&[u8]) -> usize) -> usize
pub fn pop(&mut self, f: impl FnOnce(&[u8]) -> usize) -> usize
Pop data from the buffer in-place.
The closure f
is called with the next data, it must process
some data from it and return the amount of bytes processed.
sourcepub fn pop_one(&mut self) -> Option<u8>
pub fn pop_one(&mut self) -> Option<u8>
Pop one data byte.
Returns true if popped successfully.
sourcepub fn pop_slice(&mut self) -> &mut [u8]
pub fn pop_slice(&mut self) -> &mut [u8]
Get a buffer where data can be popped from.
Equivalent to Self::pop_buf
but returns a slice.
sourcepub fn pop_buf(&mut self) -> (*mut u8, usize)
pub fn pop_buf(&mut self) -> (*mut u8, usize)
Get a buffer where data can be popped from.
Read data from the start of the buffer, then call pop_done
with
however many bytes you’ve processed.
The buffer is suitable to DMA from.
If the ringbuf is empty, size=0 will be returned.
The buffer stays valid as long as no other Reader
method is called
and init
/deinit
aren’t called on the ringbuf.
Auto Trait Implementations§
impl<'a> RefUnwindSafe for Reader<'a>
impl<'a> Send for Reader<'a>
impl<'a> Sync for Reader<'a>
impl<'a> Unpin for Reader<'a>
impl<'a> UnwindSafe for Reader<'a>
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