[][src]Trait serde_scale::Read

pub trait Read<'a> {
    type Error: Debug + Display;
    fn read_map<R, F>(&mut self, n: usize, f: F) -> Result<R, Self::Error>
    where
        F: FnOnce(Bytes<'a, '_>) -> R
; fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Self::Error> { ... } }

Interface to read bytes

Associated Types

Loading content...

Required methods

fn read_map<R, F>(&mut self, n: usize, f: F) -> Result<R, Self::Error> where
    F: FnOnce(Bytes<'a, '_>) -> R, 

Reads exactly n bytes and passes them to the given function

An error must be returned if there are fewer than n bytes left.

Loading content...

Provided methods

fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Self::Error>

Reads exactly buf.len() bytes and writes them to the supplied buffer

An error must be returned if there are fewer than buf.len() bytes left.

Loading content...

Implementations on Foreign Types

impl<'a, T: Read<'a> + ?Sized, '_> Read<'a> for &'_ mut T[src]

type Error = T::Error

impl<'a> Read<'a> for &'a [u8][src]

type Error = EndOfInput

Loading content...

Implementors

Loading content...