Trait esp_idf_svc::hal::io::asynch::BufRead

source ·
pub trait BufRead: ErrorType {
    // Required methods
    async fn fill_buf(&mut self) -> Result<&[u8], Self::Error>;
    fn consume(&mut self, amt: usize);
}
Expand description

Async buffered reader.

This trait is the embedded-io-async equivalent of [std::io::BufRead].

Required Methods§

source

async fn fill_buf(&mut self) -> Result<&[u8], Self::Error>

Return the contents of the internal buffer, filling it with more data from the inner reader if it is empty.

If no bytes are currently available to read, this function waits until at least one byte is available.

If the reader is at end-of-file (EOF), an empty slice is returned. There is no guarantee that a reader at EOF will always be so in the future, for example a reader can stop being at EOF if another process appends more bytes to the underlying file.

source

fn consume(&mut self, amt: usize)

Tell this buffer that amt bytes have been consumed from the buffer, so they should no longer be returned in calls to fill_buf.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl BufRead for &[u8]

source§

async fn fill_buf(&mut self) -> Result<&[u8], <&[u8] as ErrorType>::Error>

source§

fn consume(&mut self, amt: usize)

source§

impl<M, const N: usize> BufRead for Reader<'_, M, N>
where M: RawMutex,

source§

async fn fill_buf( &mut self, ) -> Result<&[u8], <Reader<'_, M, N> as ErrorType>::Error>

source§

fn consume(&mut self, amt: usize)

source§

impl<T> BufRead for &mut T
where T: BufRead + ?Sized,

source§

async fn fill_buf(&mut self) -> Result<&[u8], <&mut T as ErrorType>::Error>

source§

fn consume(&mut self, amt: usize)

source§

impl<T> BufRead for Box<T>
where T: BufRead + ?Sized,

source§

async fn fill_buf(&mut self) -> Result<&[u8], <Box<T> as ErrorType>::Error>

source§

fn consume(&mut self, amt: usize)

Implementors§