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.
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.