pub trait Read {
// Required method
fn read(&mut self, buf: &mut [u8]) -> Result<usize>;
// Provided method
fn read_exact(&mut self, buf: &mut [u8]) -> Result<()> { ... }
}Expand description
no_std-compatible read/write traits used by streaming APIs.
no_std-compatible read trait used by streaming interfaces.
This trait is intentionally close to std::io::Read so the same code can
be shared across std and no_std builds.
Required Methods§
Provided Methods§
Sourcefn read_exact(&mut self, buf: &mut [u8]) -> Result<()>
fn read_exact(&mut self, buf: &mut [u8]) -> Result<()>
Reads exactly buf.len() bytes into buf.
Returns:
Ok(())if the buffer was fully filled.Err(Error::Eof)if input ended early.