Trait fuel_types::canonical::Input

source ·
pub trait Input {
    // Required methods
    fn remaining(&mut self) -> usize;
    fn peek(&self, buf: &mut [u8]) -> Result<(), Error>;
    fn read(&mut self, buf: &mut [u8]) -> Result<(), Error>;
    fn skip(&mut self, n: usize) -> Result<(), Error>;

    // Provided methods
    fn peek_byte(&mut self) -> Result<u8, Error> { ... }
    fn read_byte(&mut self) -> Result<u8, Error> { ... }
}
Expand description

Allows reading of data into a slice.

Required Methods§

source

fn remaining(&mut self) -> usize

Returns the remaining length of the input data.

source

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

Peek the exact number of bytes required to fill the given buffer.

source

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

Read the exact number of bytes required to fill the given buffer.

source

fn skip(&mut self, n: usize) -> Result<(), Error>

Skips next n bytes.

Provided Methods§

source

fn peek_byte(&mut self) -> Result<u8, Error>

Peek a single byte from the input.

source

fn read_byte(&mut self) -> Result<u8, Error>

Read a single byte from the input.

Implementations on Foreign Types§

source§

impl<'a> Input for &'a [u8]

source§

fn remaining(&mut self) -> usize

source§

fn peek(&self, into: &mut [u8]) -> Result<(), Error>

source§

fn read(&mut self, into: &mut [u8]) -> Result<(), Error>

source§

fn skip(&mut self, n: usize) -> Result<(), Error>

Implementors§