multiversx_sc_codec

Trait NestedDecodeInput

Source
pub trait NestedDecodeInput {
    // Required methods
    fn remaining_len(&self) -> usize;
    fn peek_into<H>(
        &mut self,
        into: &mut [u8],
        h: H,
    ) -> Result<(), H::HandledErr>
       where H: DecodeErrorHandler;
    fn read_into<H>(
        &mut self,
        into: &mut [u8],
        h: H,
    ) -> Result<(), H::HandledErr>
       where H: DecodeErrorHandler;

    // Provided methods
    fn is_depleted(&self) -> bool { ... }
    fn supports_specialized_type<T: TryStaticCast>() -> bool { ... }
    fn read_specialized<T, C, H>(
        &mut self,
        _context: C,
        h: H,
    ) -> Result<T, H::HandledErr>
       where T: TryStaticCast,
             C: TryStaticCast,
             H: DecodeErrorHandler { ... }
    fn read_byte<H>(&mut self, h: H) -> Result<u8, H::HandledErr>
       where H: DecodeErrorHandler { ... }
}
Expand description

Trait that allows deserializing objects from a buffer.

Required Methods§

Source

fn remaining_len(&self) -> usize

The remaining length of the input data.

Source

fn peek_into<H>(&mut self, into: &mut [u8], h: H) -> Result<(), H::HandledErr>

Read the exact number of bytes required to fill the given buffer, without consuming the underlying bytes.

Will fail is not enough bytes left in buffer.

Source

fn read_into<H>(&mut self, into: &mut [u8], h: H) -> Result<(), H::HandledErr>

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

Will fail is not enough bytes left in buffer.

Provided Methods§

Source

fn is_depleted(&self) -> bool

True if all data from the buffer has already been used.

Source

fn supports_specialized_type<T: TryStaticCast>() -> bool

Source

fn read_specialized<T, C, H>( &mut self, _context: C, h: H, ) -> Result<T, H::HandledErr>

Source

fn read_byte<H>(&mut self, h: H) -> Result<u8, H::HandledErr>

Read a single byte from the input.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl NestedDecodeInput for &[u8]

A nested decode buffer implementation on referenced data.

Source§

fn remaining_len(&self) -> usize

Source§

fn peek_into<H>(&mut self, into: &mut [u8], h: H) -> Result<(), H::HandledErr>

Source§

fn read_into<H>(&mut self, into: &mut [u8], h: H) -> Result<(), H::HandledErr>

Implementors§