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>

source

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.

source

pub fn pop_one(&mut self) -> Option<u8>

Pop one data byte.

Returns true if popped successfully.

source

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.

source

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.

source

pub fn pop_done(&mut self, n: usize)

Mark n bytes as read and allow advance the read index.

Auto Trait Implementations§

§

impl<'a> Freeze for Reader<'a>

§

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

source§

fn into(self) -> U

Calls U::from(self).

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

source§

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

§

type Error = Infallible

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

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

Performs the conversion.
source§

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

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

Performs the conversion.