pub trait Read {
// Required method
fn read(&mut self, buf: &mut Vec<u8>) -> Result<bool, ReadError>;
}Expand description
Custom read abstraction that allows Reader to work without std::io::Read.
This trait is automatically implemented for &[u8] and, when the std
feature is enabled, for any std::io::Read type.
Required Methods§
Sourcefn read(&mut self, buf: &mut Vec<u8>) -> Result<bool, ReadError>
fn read(&mut self, buf: &mut Vec<u8>) -> Result<bool, ReadError>
Read data into buf, appending to its contents.
Returns Ok(true) when at least one byte was appended to buf, or
Ok(false) to signal end-of-input.
Implementations must not return Ok(true) without appending at
least one byte. Doing so is a contract violation; rather than spinning
or panicking, the Reader reports ReadErrorKind::NoProgress and
stops reading.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".