multiversx_sc_codec

Trait NestedEncodeOutput

Source
pub trait NestedEncodeOutput {
    // Required method
    fn write(&mut self, bytes: &[u8]);

    // Provided methods
    fn push_byte(&mut self, byte: u8) { ... }
    fn supports_specialized_type<T: TryStaticCast>() -> bool { ... }
    fn push_specialized<T, C, H>(
        &mut self,
        _context: C,
        _value: &T,
        h: H,
    ) -> Result<(), H::HandledErr>
       where T: TryStaticCast,
             C: TryStaticCast,
             H: EncodeErrorHandler { ... }
}
Expand description

Trait that allows appending bytes. Used especially by the NestedEncode trait to output data.

In principle it can be anything, but in practice we only keep 1 implementation, which is Vec. This is to avoid code duplication by monomorphization.

Required Methods§

Source

fn write(&mut self, bytes: &[u8])

Write to the output.

Provided Methods§

Source

fn push_byte(&mut self, byte: u8)

Write a single byte to the output.

Source

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

Source

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

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.

Implementors§