pub trait Reader<'de> {
// Required method
fn read_bytes(&mut self, n: usize) -> Result<&'de [u8], Error>;
// Provided method
fn read_byte(&mut self) -> Result<u8, Error> { ... }
}Expand description
Raw byte source that lends buffer-lifetime views. 'de is the lifetime
of the underlying buffer. Reads consume forward; there is no rewind, no peek.
Only slice-backed readers (where all the data is already present) can
implement this, since read_bytes must return a view that outlives the
&mut self borrow.
Required Methods§
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".