pub trait Read {
// Required method
fn read_some(&mut self, buf: &mut [u8]) -> usize;
}Expand description
The minimal byte source Digest::from_stream reads from.
The kit is no_std and core-only, so it cannot name
std::io::Read; this trait carries the one operation a digest
needs: pull some bytes now, returning how many. Host code adapts a
real reader in one line, e.g. for std::io::Read:
fn read_some(&mut self, buf: &mut [u8]) -> usize { self.0.read(buf).unwrap_or(0) }
— an I/O error surfaces as exhaustion, which from_stream reports
as Error::Truncated.
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".