Trait multiversx_sc_codec::NestedEncode
source · pub trait NestedEncode: Sized {
// Provided methods
fn dep_encode<O: NestedEncodeOutput>(
&self,
dest: &mut O
) -> Result<(), EncodeError> { ... }
fn dep_encode_or_handle_err<O, H>(
&self,
dest: &mut O,
h: H
) -> Result<(), H::HandledErr>
where O: NestedEncodeOutput,
H: EncodeErrorHandler { ... }
}
Expand description
Trait that allows zero-copy write of value-references to slices in LE format.
Implementations should override using_top_encoded
for value types and dep_encode
and size_hint
for allocating types.
Wrapper types should override all methods.
Provided Methods§
sourcefn dep_encode<O: NestedEncodeOutput>(
&self,
dest: &mut O
) -> Result<(), EncodeError>
fn dep_encode<O: NestedEncodeOutput>( &self, dest: &mut O ) -> Result<(), EncodeError>
NestedEncode to output, using the format of an object nested inside another structure. Does not provide compact version.
sourcefn dep_encode_or_handle_err<O, H>(
&self,
dest: &mut O,
h: H
) -> Result<(), H::HandledErr>where
O: NestedEncodeOutput,
H: EncodeErrorHandler,
fn dep_encode_or_handle_err<O, H>(
&self,
dest: &mut O,
h: H
) -> Result<(), H::HandledErr>where
O: NestedEncodeOutput,
H: EncodeErrorHandler,
Version of dep_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.
Object Safety§
This trait is not object safe.