pub trait BorrowReader<'storage>: Reader {
// Required method
fn take_bytes(
&mut self,
length: usize,
) -> Result<&'storage [u8], DecodeError>;
}Expand description
A reader for borrowed data. Implementors of this must also implement the Reader trait. See the module documentation for more information.
Required Methods§
Sourcefn take_bytes(&mut self, length: usize) -> Result<&'storage [u8], DecodeError>
fn take_bytes(&mut self, length: usize) -> Result<&'storage [u8], DecodeError>
Read exactly length bytes and return a slice to this data. If not enough bytes could be read, an error should be returned.
note: Exactly length bytes must be returned. If less bytes are returned, bincode may panic. If more bytes are returned, the excess bytes may be discarded.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".