Trait embedded_io::blocking::Read

source ·
pub trait Read: Io {
    // Required method
    fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>;

    // Provided method
    fn read_exact(
        &mut self,
        buf: &mut [u8],
    ) -> Result<(), ReadExactError<Self::Error>> { ... }
}
Expand description

Blocking reader.

Semantics are the same as [std::io::Read], check its documentation for details.

Required Methods§

source

fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>

Pull some bytes from this source into the specified buffer, returning how many bytes were read.

Provided Methods§

source

fn read_exact( &mut self, buf: &mut [u8], ) -> Result<(), ReadExactError<Self::Error>>

Read the exact number of bytes required to fill buf.

Implementations on Foreign Types§

source§

impl Read for &[u8]

Read is implemented for &[u8] by copying from the slice.

Note that reading updates the slice to point to the yet unread part. The slice will be empty when EOF is reached.

source§

fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>

source§

impl<T: ?Sized + Read> Read for &mut T

source§

fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>

source§

impl<T: ?Sized + Read> Read for Box<T>

Available on crate features std or alloc only.
source§

fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>

Implementors§