multiversx_sc_codec

Trait TopEncode

Source
pub trait TopEncode: Sized {
    // Provided methods
    fn top_encode<O>(&self, output: O) -> Result<(), EncodeError>
       where O: TopEncodeOutput { ... }
    fn top_encode_or_handle_err<O, H>(
        &self,
        output: O,
        h: H,
    ) -> Result<(), H::HandledErr>
       where O: TopEncodeOutput,
             H: EncodeErrorHandler { ... }
}

Provided Methods§

Source

fn top_encode<O>(&self, output: O) -> Result<(), EncodeError>
where O: TopEncodeOutput,

Attempt to serialize the value to ouput.

Source

fn top_encode_or_handle_err<O, H>( &self, output: O, h: H, ) -> Result<(), H::HandledErr>

Version of top_encode that can handle errors as soon as they occur. For instance in can exit immediately and make sure that if it returns, it is a success. By not deferring error handling, this can lead to somewhat smaller bytecode.

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 TopEncode for &str

Source§

fn top_encode_or_handle_err<O, H>( &self, output: O, _h: H, ) -> Result<(), H::HandledErr>

Source§

impl TopEncode for bool

Source§

fn top_encode_or_handle_err<O, H>( &self, output: O, _h: H, ) -> Result<(), H::HandledErr>

Source§

impl TopEncode for i8

Source§

fn top_encode_or_handle_err<O, H>( &self, output: O, _h: H, ) -> Result<(), H::HandledErr>

Source§

impl TopEncode for i16

Source§

fn top_encode_or_handle_err<O, H>( &self, output: O, _h: H, ) -> Result<(), H::HandledErr>

Source§

impl TopEncode for i32

Source§

fn top_encode_or_handle_err<O, H>( &self, output: O, _h: H, ) -> Result<(), H::HandledErr>

Source§

impl TopEncode for i64

Source§

fn top_encode_or_handle_err<O, H>( &self, output: O, _h: H, ) -> Result<(), H::HandledErr>

Source§

impl TopEncode for isize

Source§

fn top_encode_or_handle_err<O, H>( &self, output: O, _h: H, ) -> Result<(), H::HandledErr>

Source§

impl TopEncode for u8

Source§

fn top_encode_or_handle_err<O, H>( &self, output: O, _h: H, ) -> Result<(), H::HandledErr>

Source§

impl TopEncode for u16

Source§

fn top_encode_or_handle_err<O, H>( &self, output: O, _h: H, ) -> Result<(), H::HandledErr>

Source§

impl TopEncode for u32

Source§

fn top_encode_or_handle_err<O, H>( &self, output: O, _h: H, ) -> Result<(), H::HandledErr>

Source§

impl TopEncode for u64

Source§

fn top_encode_or_handle_err<O, H>( &self, output: O, _h: H, ) -> Result<(), H::HandledErr>

Source§

impl TopEncode for usize

Source§

fn top_encode_or_handle_err<O, H>( &self, output: O, _h: H, ) -> Result<(), H::HandledErr>

Source§

impl TopEncode for Box<str>

Source§

fn top_encode_or_handle_err<O, H>( &self, output: O, h: H, ) -> Result<(), H::HandledErr>

Source§

impl TopEncode for String

Source§

fn top_encode_or_handle_err<O, H>( &self, output: O, h: H, ) -> Result<(), H::HandledErr>

Source§

impl TopEncode for NonZeroUsize

Source§

fn top_encode_or_handle_err<O, H>( &self, output: O, h: H, ) -> Result<(), H::HandledErr>

Source§

impl<T0> TopEncode for (T0,)
where T0: NestedEncode,

Source§

fn top_encode_or_handle_err<O, H>( &self, output: O, h: H, ) -> Result<(), H::HandledErr>

Source§

impl<T0, T1> TopEncode for (T0, T1)
where T0: NestedEncode, T1: NestedEncode,

Source§

fn top_encode_or_handle_err<O, H>( &self, output: O, h: H, ) -> Result<(), H::HandledErr>

Source§

impl<T0, T1, T2> TopEncode for (T0, T1, T2)

Source§

fn top_encode_or_handle_err<O, H>( &self, output: O, h: H, ) -> Result<(), H::HandledErr>

Source§

impl<T0, T1, T2, T3> TopEncode for (T0, T1, T2, T3)

Source§

fn top_encode_or_handle_err<O, H>( &self, output: O, h: H, ) -> Result<(), H::HandledErr>

Source§

impl<T0, T1, T2, T3, T4> TopEncode for (T0, T1, T2, T3, T4)

Source§

fn top_encode_or_handle_err<O, H>( &self, output: O, h: H, ) -> Result<(), H::HandledErr>

Source§

impl<T0, T1, T2, T3, T4, T5> TopEncode for (T0, T1, T2, T3, T4, T5)

Source§

fn top_encode_or_handle_err<O, H>( &self, output: O, h: H, ) -> Result<(), H::HandledErr>

Source§

impl<T0, T1, T2, T3, T4, T5, T6> TopEncode for (T0, T1, T2, T3, T4, T5, T6)

Source§

fn top_encode_or_handle_err<O, H>( &self, output: O, h: H, ) -> Result<(), H::HandledErr>

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7> TopEncode for (T0, T1, T2, T3, T4, T5, T6, T7)

Source§

fn top_encode_or_handle_err<O, H>( &self, output: O, h: H, ) -> Result<(), H::HandledErr>

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8> TopEncode for (T0, T1, T2, T3, T4, T5, T6, T7, T8)

Source§

fn top_encode_or_handle_err<O, H>( &self, output: O, h: H, ) -> Result<(), H::HandledErr>

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> TopEncode for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)

Source§

fn top_encode_or_handle_err<O, H>( &self, output: O, h: H, ) -> Result<(), H::HandledErr>

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> TopEncode for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)

Source§

fn top_encode_or_handle_err<O, H>( &self, output: O, h: H, ) -> Result<(), H::HandledErr>

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> TopEncode for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)

Source§

fn top_encode_or_handle_err<O, H>( &self, output: O, h: H, ) -> Result<(), H::HandledErr>

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> TopEncode for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)

Source§

fn top_encode_or_handle_err<O, H>( &self, output: O, h: H, ) -> Result<(), H::HandledErr>

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> TopEncode for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13)

Source§

fn top_encode_or_handle_err<O, H>( &self, output: O, h: H, ) -> Result<(), H::HandledErr>

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> TopEncode for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14)

Source§

fn top_encode_or_handle_err<O, H>( &self, output: O, h: H, ) -> Result<(), H::HandledErr>

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> TopEncode for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15)

Source§

fn top_encode_or_handle_err<O, H>( &self, output: O, h: H, ) -> Result<(), H::HandledErr>

Source§

impl<T> TopEncode for PhantomData<T>

Empty structure with an empty bytes representation. Equivalent to false, 0 or [u8; 0], but more explicit.

Note: the unit type () would have naturally fit this role, but we decided to make the unit type multi-value only.

Source§

fn top_encode_or_handle_err<O, H>( &self, output: O, _h: H, ) -> Result<(), H::HandledErr>

Source§

impl<T: NestedEncode> TopEncode for &[T]

Source§

fn top_encode_or_handle_err<O, H>( &self, output: O, h: H, ) -> Result<(), H::HandledErr>

Source§

impl<T: NestedEncode> TopEncode for Option<T>

Source§

fn top_encode_or_handle_err<O, H>( &self, output: O, h: H, ) -> Result<(), H::HandledErr>

Allow None to be serialized to empty bytes, but leave the leading “1” for Some, to allow disambiguation between e.g. Some(0) and None.

Source§

impl<T: NestedEncode> TopEncode for Box<[T]>

Source§

fn top_encode_or_handle_err<O, H>( &self, output: O, h: H, ) -> Result<(), H::HandledErr>

Source§

impl<T: NestedEncode, const CAP: usize> TopEncode for ArrayVec<T, CAP>

Source§

fn top_encode_or_handle_err<O, H>( &self, output: O, h: H, ) -> Result<(), H::HandledErr>

Source§

impl<T: NestedEncode, const N: usize> TopEncode for [T; N]

Source§

fn top_encode_or_handle_err<O, H>( &self, output: O, h: H, ) -> Result<(), H::HandledErr>

Source§

impl<T: TopEncode> TopEncode for &T

Source§

fn top_encode_or_handle_err<O, H>( &self, output: O, h: H, ) -> Result<(), H::HandledErr>

Source§

impl<T: TopEncode> TopEncode for Box<T>

Source§

fn top_encode_or_handle_err<O, H>( &self, output: O, h: H, ) -> Result<(), H::HandledErr>

Implementors§