pub trait Reads {
// Required method
fn read(&mut self, buf: &mut [u8]) -> Result<usize, StreamError>;
// Provided method
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), StreamError> { ... }
}Expand description
A thing that reads from a stream of bytes.
Required Methods§
Provided Methods§
Sourcefn read_exact(&mut self, buf: &mut [u8]) -> Result<(), StreamError>
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), StreamError>
Reads exactly buf.len() bytes into buf.
If an error occurs, the state of buf and
the number of bytes read is undefined.