pub trait TopEncode: Sized {
    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::HandledErr>
    where
        O: TopEncodeOutput,
        H: EncodeErrorHandler
, { ... } }

Provided Methods§

Attempt to serialize the value to ouput.

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.

Implementations on Foreign Types§

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.

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.

Implementors§