Trait dharitri_codec::NestedEncode
source · pub trait NestedEncode: Sized {
// Required method
fn dep_encode<O: NestedEncodeOutput>(
&self,
dest: &mut O
) -> Result<(), EncodeError>;
// Provided method
fn dep_encode_or_exit<O: NestedEncodeOutput, ExitCtx: Clone>(
&self,
dest: &mut O,
c: ExitCtx,
exit: fn(_: ExitCtx, _: EncodeError) -> !
) { ... }
}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.
Required 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.
Provided Methods§
sourcefn dep_encode_or_exit<O: NestedEncodeOutput, ExitCtx: Clone>(
&self,
dest: &mut O,
c: ExitCtx,
exit: fn(_: ExitCtx, _: EncodeError) -> !
)
fn dep_encode_or_exit<O: NestedEncodeOutput, ExitCtx: Clone>( &self, dest: &mut O, c: ExitCtx, exit: fn(_: ExitCtx, _: EncodeError) -> ! )
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.
Object Safety§
This trait is not object safe.