pub trait Reader<'de>: ReadBytesExt {
    // Required method
    fn buffered_read_bytes(
        &mut self,
        length: usize,
        scratch: &mut Vec<u8>
    ) -> Result<BufferedBytes<'de>, Error>;
}
Expand description

A reader that can temporarily buffer bytes read.

Required Methods§

fn buffered_read_bytes( &mut self, length: usize, scratch: &mut Vec<u8> ) -> Result<BufferedBytes<'de>, Error>

Reads exactly length bytes.

If the reader supports borrowing bytes, BufferedBytes::Data should be returned. Otherwise, the bytes will be read into scratch. scratch should only be assumed to be valid if BufferedBytes::Scratch is returned.

Object Safety§

This trait is not object safe.

Implementors§

§

impl<'de> Reader<'de> for SliceReader<'de>

§

impl<'de, R> Reader<'de> for IoReader<R>
where R: ReadBytesExt,