Trait elrond_codec::NestedDecode
source · [−]pub trait NestedDecode: Sized {
fn dep_decode<I: NestedDecodeInput>(
input: &mut I
) -> Result<Self, DecodeError>;
fn dep_decode_or_exit<I: NestedDecodeInput, ExitCtx: Clone>(
input: &mut I,
c: ExitCtx,
exit: fn(_: ExitCtx, _: DecodeError) -> !
) -> Self { ... }
}Expand description
Trait that allows zero-copy read of value-references from slices in LE format.
Required methods
fn dep_decode<I: NestedDecodeInput>(input: &mut I) -> Result<Self, DecodeError>
fn dep_decode<I: NestedDecodeInput>(input: &mut I) -> Result<Self, DecodeError>
Attempt to deserialise the value from input, using the format of an object nested inside another structure. In case of success returns the deserialized value and the number of bytes consumed during the operation.
Provided methods
fn dep_decode_or_exit<I: NestedDecodeInput, ExitCtx: Clone>(
input: &mut I,
c: ExitCtx,
exit: fn(_: ExitCtx, _: DecodeError) -> !
) -> Self
fn dep_decode_or_exit<I: NestedDecodeInput, ExitCtx: Clone>(
input: &mut I,
c: ExitCtx,
exit: fn(_: ExitCtx, _: DecodeError) -> !
) -> Self
Version of top_decode that exits quickly in case of error.
Its purpose is to create smaller implementations
in cases where the application is supposed to exit directly on decode error.