Trait bincode::de::read::BorrowReader

source ·
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§

source

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.

Implementors§

source§

impl<'storage> BorrowReader<'storage> for SliceReader<'storage>