multiversx_sc::imports

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 as EncodeErrorHandler>::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 as EncodeErrorHandler>::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 as EncodeErrorHandler>::HandledErr>

Source§

impl TopEncode for bool

Source§

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

Source§

impl TopEncode for i8

Source§

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

Source§

impl TopEncode for i16

Source§

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

Source§

impl TopEncode for i32

Source§

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

Source§

impl TopEncode for i64

Source§

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

Source§

impl TopEncode for isize

Source§

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

Source§

impl TopEncode for u8

Source§

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

Source§

impl TopEncode for u16

Source§

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

Source§

impl TopEncode for u32

Source§

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

Source§

impl TopEncode for u64

Source§

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

Source§

impl TopEncode for usize

Source§

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

Source§

impl TopEncode for NonZero<usize>

Source§

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

Source§

impl TopEncode for HeapAddress

Source§

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

Source§

impl TopEncode for HeapH256

Source§

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

Source§

impl TopEncode for BigInt

Source§

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

Source§

impl TopEncode for BigUint

Source§

fn top_encode_or_handle_err<O, H>( &self, output: O, h: H, ) -> Result<(), <H as EncodeErrorHandler>::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 as EncodeErrorHandler>::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 as EncodeErrorHandler>::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 as EncodeErrorHandler>::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 as EncodeErrorHandler>::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 as EncodeErrorHandler>::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 as EncodeErrorHandler>::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 as EncodeErrorHandler>::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 as EncodeErrorHandler>::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 as EncodeErrorHandler>::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 as EncodeErrorHandler>::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 as EncodeErrorHandler>::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 as EncodeErrorHandler>::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 as EncodeErrorHandler>::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 as EncodeErrorHandler>::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 as EncodeErrorHandler>::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 as EncodeErrorHandler>::HandledErr>

Source§

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

Source§

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

Source§

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

Source§

fn top_encode_or_handle_err<O, H>( &self, output: O, h: H, ) -> Result<(), <H as EncodeErrorHandler>::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> TopEncode for &T
where T: TopEncode,

Source§

fn top_encode_or_handle_err<O, H>( &self, output: O, h: H, ) -> Result<(), <H as EncodeErrorHandler>::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 as EncodeErrorHandler>::HandledErr>

Source§

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

Source§

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

Implementors§

Source§

impl TopEncode for EsdtLocalRole

Source§

impl TopEncode for EsdtTokenType

Source§

impl TopEncode for MessageHashType

Source§

impl TopEncode for OperationCompletionStatus

Source§

impl TopEncode for Sign

Source§

impl TopEncode for Address

Source§

impl TopEncode for Box<str>

Source§

impl TopEncode for BoxedBytes

Source§

impl TopEncode for H256

Source§

impl TopEncode for String

Source§

impl TopEncode for CodeMetadata

Source§

impl TopEncode for ESDTSystemSCAddress

Source§

impl TopEncode for TestAddress<'_>

Source§

impl TopEncode for TestSCAddress<'_>

Source§

impl TopEncode for TestTokenIdentifier<'_>

Source§

impl TopEncode for Empty

Source§

impl<E, const CAPACITY: usize> TopEncode for SparseArray<E, CAPACITY>
where E: ErrorApi,

Source§

impl<M> TopEncode for CallbackClosure<M>

Source§

impl<M> TopEncode for ManagedAddress<M>
where M: ManagedTypeApi,

Source§

impl<M> TopEncode for ManagedArgBuffer<M>
where M: ManagedTypeApi,

Source§

impl<M, T> TopEncode for ManagedOption<M, T>

Source§

impl<M, T> TopEncode for ManagedRef<'_, M, T>

Source§

impl<M, T> TopEncode for ManagedRefMut<'_, M, T>

Source§

impl<M, T> TopEncode for ManagedVec<M, T>

Source§

impl<M, const N: usize> TopEncode for ManagedByteArray<M, N>
where M: ManagedTypeApi,

Source§

impl<M: ManagedTypeApi> TopEncode for TokenMapperState<M>

Source§

impl<M: ManagedTypeApi> TopEncode for EgldOrMultiEsdtPayment<M>

Source§

impl<M: ManagedTypeApi> TopEncode for BigFloat<M>

Source§

impl<M: ManagedTypeApi> TopEncode for multiversx_sc::types::BigInt<M>

Source§

impl<M: ManagedTypeApi> TopEncode for multiversx_sc::types::BigUint<M>

Source§

impl<M: ManagedTypeApi> TopEncode for EgldOrEsdtTokenIdentifier<M>

Source§

impl<M: ManagedTypeApi> TopEncode for EgldOrEsdtTokenPayment<M>

Source§

impl<M: ManagedTypeApi> TopEncode for EllipticCurve<M>

Source§

impl<M: ManagedTypeApi> TopEncode for EsdtTokenData<M>

Source§

impl<M: ManagedTypeApi> TopEncode for EsdtTokenPayment<M>

Source§

impl<M: ManagedTypeApi> TopEncode for ManagedBuffer<M>

Source§

impl<M: ManagedTypeApi> TopEncode for ManagedDecimal<M, NumDecimals>

Source§

impl<M: ManagedTypeApi> TopEncode for ManagedDecimalSigned<M, NumDecimals>

Source§

impl<M: ManagedTypeApi> TopEncode for TokenIdentifier<M>

Source§

impl<M: ManagedTypeApi, const DECIMALS: NumDecimals> TopEncode for ManagedDecimal<M, ConstDecimals<DECIMALS>>

Source§

impl<M: ManagedTypeApi, const DECIMALS: NumDecimals> TopEncode for ManagedDecimalSigned<M, ConstDecimals<DECIMALS>>

Source§

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

Source§

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

Source§

impl<T> TopEncode for Vec<T>
where T: NestedEncode,

Source§

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

Source§

impl<T: NestedEncode + NestedDecode + PartialOrd + PartialEq + Clone> TopEncode for OrderedBinaryTreeNode<T>

Source§

impl<T: NestedEncode + NestedDecode + TopEncode + TopDecode + Clone> TopEncode for LinkedListNode<T>

Source§

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

Source§

impl<T: TopEncode + TopDecode> TopEncode for SingleValue<T>