pub trait Reader<'a> {
// Required methods
fn version(&self) -> Version;
fn read(&mut self, bytes: &mut [u8]) -> ReadResult;
fn read_slice(&mut self, len: usize) -> ReadResult<&'a [u8]>;
}Expand description
Generic reader
Required Methods§
Sourcefn read(&mut self, bytes: &mut [u8]) -> ReadResult
fn read(&mut self, bytes: &mut [u8]) -> ReadResult
Fill the given slice with bytes. All bytes must be read.
Sourcefn read_slice(&mut self, len: usize) -> ReadResult<&'a [u8]>
fn read_slice(&mut self, len: usize) -> ReadResult<&'a [u8]>
Read a slice of length len from the reader. Must be return exactly the amount of bytes being requested.
If the reader does not have it’s own internal buffer (e.g. std::fs::File) ReadError::ReaderNotPersistent should be returned.