pub trait Reader {
// Required method
fn read(&mut self, bytes: &mut [u8]) -> Result<(), DecodeError>;
// Provided methods
fn peek_read(&mut self, _: usize) -> Option<&[u8]> { ... }
fn consume(&mut self, _: usize) { ... }
}Expand description
A reader for owned data. See the module documentation for more information.
Required Methods§
Sourcefn read(&mut self, bytes: &mut [u8]) -> Result<(), DecodeError>
fn read(&mut self, bytes: &mut [u8]) -> Result<(), DecodeError>
Fill the given bytes argument with values. Exactly the length of the given slice must be filled, or else an error must be returned.
Fill the given bytes argument with values. Exactly the length of the given slice must be filled, or else an error must be returned.
§Errors
Returns DecodeError::UnexpectedEnd if the reader does not have enough bytes.