pub trait TopEncode: Sized {
    // Required method
    fn top_encode<O: TopEncodeOutput>(
        &self,
        output: O
    ) -> Result<(), EncodeError>;

    // Provided method
    fn top_encode_or_exit<O: TopEncodeOutput, ExitCtx: Clone>(
        &self,
        output: O,
        c: ExitCtx,
        exit: fn(_: ExitCtx, _: EncodeError) -> !
    ) { ... }
}

Required Methods§

source

fn top_encode<O: TopEncodeOutput>(&self, output: O) -> Result<(), EncodeError>

Attempt to serialize the value to ouput.

Provided Methods§

source

fn top_encode_or_exit<O: TopEncodeOutput, ExitCtx: Clone>( &self, output: O, c: ExitCtx, exit: fn(_: ExitCtx, _: EncodeError) -> ! )

Version of top_decode that exits quickly in case of error. Its purpose is to create smaller bytecode implementations in cases where the application is supposed to exit directly on decode error.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl TopEncode for &str

source§

fn top_encode<O: TopEncodeOutput>(&self, output: O) -> Result<(), EncodeError>

source§

fn top_encode_or_exit<O: TopEncodeOutput, ExitCtx: Clone>( &self, output: O, _: ExitCtx, _: fn(_: ExitCtx, _: EncodeError) -> ! )

source§

impl TopEncode for bool

source§

fn top_encode<O: TopEncodeOutput>(&self, output: O) -> Result<(), EncodeError>

source§

fn top_encode_or_exit<O: TopEncodeOutput, ExitCtx: Clone>( &self, output: O, _: ExitCtx, _: fn(_: ExitCtx, _: EncodeError) -> ! )

source§

impl TopEncode for i8

source§

fn top_encode<O: TopEncodeOutput>(&self, output: O) -> Result<(), EncodeError>

source§

fn top_encode_or_exit<O: TopEncodeOutput, ExitCtx: Clone>( &self, output: O, _: ExitCtx, _: fn(_: ExitCtx, _: EncodeError) -> ! )

source§

impl TopEncode for i16

source§

fn top_encode<O: TopEncodeOutput>(&self, output: O) -> Result<(), EncodeError>

source§

fn top_encode_or_exit<O: TopEncodeOutput, ExitCtx: Clone>( &self, output: O, _: ExitCtx, _: fn(_: ExitCtx, _: EncodeError) -> ! )

source§

impl TopEncode for i32

source§

fn top_encode<O: TopEncodeOutput>(&self, output: O) -> Result<(), EncodeError>

source§

fn top_encode_or_exit<O: TopEncodeOutput, ExitCtx: Clone>( &self, output: O, _: ExitCtx, _: fn(_: ExitCtx, _: EncodeError) -> ! )

source§

impl TopEncode for i64

source§

fn top_encode<O: TopEncodeOutput>(&self, output: O) -> Result<(), EncodeError>

source§

fn top_encode_or_exit<O: TopEncodeOutput, ExitCtx: Clone>( &self, output: O, _: ExitCtx, _: fn(_: ExitCtx, _: EncodeError) -> ! )

source§

impl TopEncode for isize

source§

fn top_encode<O: TopEncodeOutput>(&self, output: O) -> Result<(), EncodeError>

source§

fn top_encode_or_exit<O: TopEncodeOutput, ExitCtx: Clone>( &self, output: O, _: ExitCtx, _: fn(_: ExitCtx, _: EncodeError) -> ! )

source§

impl TopEncode for u8

source§

fn top_encode<O: TopEncodeOutput>(&self, output: O) -> Result<(), EncodeError>

source§

fn top_encode_or_exit<O: TopEncodeOutput, ExitCtx: Clone>( &self, output: O, _: ExitCtx, _: fn(_: ExitCtx, _: EncodeError) -> ! )

source§

impl TopEncode for u16

source§

fn top_encode<O: TopEncodeOutput>(&self, output: O) -> Result<(), EncodeError>

source§

fn top_encode_or_exit<O: TopEncodeOutput, ExitCtx: Clone>( &self, output: O, _: ExitCtx, _: fn(_: ExitCtx, _: EncodeError) -> ! )

source§

impl TopEncode for u32

source§

fn top_encode<O: TopEncodeOutput>(&self, output: O) -> Result<(), EncodeError>

source§

fn top_encode_or_exit<O: TopEncodeOutput, ExitCtx: Clone>( &self, output: O, _: ExitCtx, _: fn(_: ExitCtx, _: EncodeError) -> ! )

source§

impl TopEncode for u64

source§

fn top_encode<O: TopEncodeOutput>(&self, output: O) -> Result<(), EncodeError>

source§

fn top_encode_or_exit<O: TopEncodeOutput, ExitCtx: Clone>( &self, output: O, _: ExitCtx, _: fn(_: ExitCtx, _: EncodeError) -> ! )

source§

impl TopEncode for ()

source§

fn top_encode<O: TopEncodeOutput>(&self, output: O) -> Result<(), EncodeError>

source§

fn top_encode_or_exit<O: TopEncodeOutput, ExitCtx: Clone>( &self, output: O, _: ExitCtx, _: fn(_: ExitCtx, _: EncodeError) -> ! )

source§

impl TopEncode for usize

source§

fn top_encode<O: TopEncodeOutput>(&self, output: O) -> Result<(), EncodeError>

source§

fn top_encode_or_exit<O: TopEncodeOutput, ExitCtx: Clone>( &self, output: O, _: ExitCtx, _: fn(_: ExitCtx, _: EncodeError) -> ! )

source§

impl TopEncode for Box<str>

source§

fn top_encode<O: TopEncodeOutput>(&self, output: O) -> Result<(), EncodeError>

source§

fn top_encode_or_exit<O: TopEncodeOutput, ExitCtx: Clone>( &self, output: O, c: ExitCtx, exit: fn(_: ExitCtx, _: EncodeError) -> ! )

source§

impl TopEncode for String

source§

fn top_encode<O: TopEncodeOutput>(&self, output: O) -> Result<(), EncodeError>

source§

fn top_encode_or_exit<O: TopEncodeOutput, ExitCtx: Clone>( &self, output: O, c: ExitCtx, exit: fn(_: ExitCtx, _: EncodeError) -> ! )

source§

impl TopEncode for NonZeroUsize

source§

fn top_encode<O: TopEncodeOutput>(&self, output: O) -> Result<(), EncodeError>

source§

fn top_encode_or_exit<O: TopEncodeOutput, ExitCtx: Clone>( &self, output: O, c: ExitCtx, exit: fn(_: ExitCtx, _: EncodeError) -> ! )

source§

impl<T0> TopEncode for (T0,)
where T0: NestedEncode,

source§

fn top_encode<O: TopEncodeOutput>(&self, output: O) -> Result<(), EncodeError>

source§

fn top_encode_or_exit<O: TopEncodeOutput, ExitCtx: Clone>( &self, output: O, c: ExitCtx, exit: fn(_: ExitCtx, _: EncodeError) -> ! )

source§

impl<T0, T1> TopEncode for (T0, T1)
where T0: NestedEncode, T1: NestedEncode,

source§

fn top_encode<O: TopEncodeOutput>(&self, output: O) -> Result<(), EncodeError>

source§

fn top_encode_or_exit<O: TopEncodeOutput, ExitCtx: Clone>( &self, output: O, c: ExitCtx, exit: fn(_: ExitCtx, _: EncodeError) -> ! )

source§

impl<T0, T1, T2> TopEncode for (T0, T1, T2)

source§

fn top_encode<O: TopEncodeOutput>(&self, output: O) -> Result<(), EncodeError>

source§

fn top_encode_or_exit<O: TopEncodeOutput, ExitCtx: Clone>( &self, output: O, c: ExitCtx, exit: fn(_: ExitCtx, _: EncodeError) -> ! )

source§

impl<T0, T1, T2, T3> TopEncode for (T0, T1, T2, T3)

source§

fn top_encode<O: TopEncodeOutput>(&self, output: O) -> Result<(), EncodeError>

source§

fn top_encode_or_exit<O: TopEncodeOutput, ExitCtx: Clone>( &self, output: O, c: ExitCtx, exit: fn(_: ExitCtx, _: EncodeError) -> ! )

source§

impl<T0, T1, T2, T3, T4> TopEncode for (T0, T1, T2, T3, T4)

source§

fn top_encode<O: TopEncodeOutput>(&self, output: O) -> Result<(), EncodeError>

source§

fn top_encode_or_exit<O: TopEncodeOutput, ExitCtx: Clone>( &self, output: O, c: ExitCtx, exit: fn(_: ExitCtx, _: EncodeError) -> ! )

source§

impl<T0, T1, T2, T3, T4, T5> TopEncode for (T0, T1, T2, T3, T4, T5)

source§

fn top_encode<O: TopEncodeOutput>(&self, output: O) -> Result<(), EncodeError>

source§

fn top_encode_or_exit<O: TopEncodeOutput, ExitCtx: Clone>( &self, output: O, c: ExitCtx, exit: fn(_: ExitCtx, _: EncodeError) -> ! )

source§

impl<T0, T1, T2, T3, T4, T5, T6> TopEncode for (T0, T1, T2, T3, T4, T5, T6)

source§

fn top_encode<O: TopEncodeOutput>(&self, output: O) -> Result<(), EncodeError>

source§

fn top_encode_or_exit<O: TopEncodeOutput, ExitCtx: Clone>( &self, output: O, c: ExitCtx, exit: fn(_: ExitCtx, _: EncodeError) -> ! )

source§

impl<T0, T1, T2, T3, T4, T5, T6, T7> TopEncode for (T0, T1, T2, T3, T4, T5, T6, T7)

source§

fn top_encode<O: TopEncodeOutput>(&self, output: O) -> Result<(), EncodeError>

source§

fn top_encode_or_exit<O: TopEncodeOutput, ExitCtx: Clone>( &self, output: O, c: ExitCtx, exit: fn(_: ExitCtx, _: EncodeError) -> ! )

source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8> TopEncode for (T0, T1, T2, T3, T4, T5, T6, T7, T8)

source§

fn top_encode<O: TopEncodeOutput>(&self, output: O) -> Result<(), EncodeError>

source§

fn top_encode_or_exit<O: TopEncodeOutput, ExitCtx: Clone>( &self, output: O, c: ExitCtx, exit: fn(_: ExitCtx, _: EncodeError) -> ! )

source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> TopEncode for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)

source§

fn top_encode<O: TopEncodeOutput>(&self, output: O) -> Result<(), EncodeError>

source§

fn top_encode_or_exit<O: TopEncodeOutput, ExitCtx: Clone>( &self, output: O, c: ExitCtx, exit: fn(_: ExitCtx, _: EncodeError) -> ! )

source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> TopEncode for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)

source§

fn top_encode<O: TopEncodeOutput>(&self, output: O) -> Result<(), EncodeError>

source§

fn top_encode_or_exit<O: TopEncodeOutput, ExitCtx: Clone>( &self, output: O, c: ExitCtx, exit: fn(_: ExitCtx, _: EncodeError) -> ! )

source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> TopEncode for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)

source§

fn top_encode<O: TopEncodeOutput>(&self, output: O) -> Result<(), EncodeError>

source§

fn top_encode_or_exit<O: TopEncodeOutput, ExitCtx: Clone>( &self, output: O, c: ExitCtx, exit: fn(_: ExitCtx, _: EncodeError) -> ! )

source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> TopEncode for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)

source§

fn top_encode<O: TopEncodeOutput>(&self, output: O) -> Result<(), EncodeError>

source§

fn top_encode_or_exit<O: TopEncodeOutput, ExitCtx: Clone>( &self, output: O, c: ExitCtx, exit: fn(_: ExitCtx, _: EncodeError) -> ! )

source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> TopEncode for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13)

source§

fn top_encode<O: TopEncodeOutput>(&self, output: O) -> Result<(), EncodeError>

source§

fn top_encode_or_exit<O: TopEncodeOutput, ExitCtx: Clone>( &self, output: O, c: ExitCtx, exit: fn(_: ExitCtx, _: EncodeError) -> ! )

source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> TopEncode for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14)

source§

fn top_encode<O: TopEncodeOutput>(&self, output: O) -> Result<(), EncodeError>

source§

fn top_encode_or_exit<O: TopEncodeOutput, ExitCtx: Clone>( &self, output: O, c: ExitCtx, exit: fn(_: ExitCtx, _: EncodeError) -> ! )

source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> TopEncode for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15)

source§

fn top_encode<O: TopEncodeOutput>(&self, output: O) -> Result<(), EncodeError>

source§

fn top_encode_or_exit<O: TopEncodeOutput, ExitCtx: Clone>( &self, output: O, c: ExitCtx, exit: fn(_: ExitCtx, _: EncodeError) -> ! )

source§

impl<T: NestedEncode> TopEncode for &[T]

source§

fn top_encode<O: TopEncodeOutput>(&self, output: O) -> Result<(), EncodeError>

source§

fn top_encode_or_exit<O: TopEncodeOutput, ExitCtx: Clone>( &self, output: O, c: ExitCtx, exit: fn(_: ExitCtx, _: EncodeError) -> ! )

source§

impl<T: NestedEncode> TopEncode for Option<T>

source§

fn top_encode<O: TopEncodeOutput>(&self, output: O) -> Result<(), EncodeError>

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.

source§

fn top_encode_or_exit<O: TopEncodeOutput, ExitCtx: Clone>( &self, output: O, c: ExitCtx, exit: fn(_: ExitCtx, _: EncodeError) -> ! )

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.

source§

impl<T: NestedEncode> TopEncode for Box<[T]>

source§

fn top_encode<O: TopEncodeOutput>(&self, output: O) -> Result<(), EncodeError>

source§

fn top_encode_or_exit<O: TopEncodeOutput, ExitCtx: Clone>( &self, output: O, c: ExitCtx, exit: fn(_: ExitCtx, _: EncodeError) -> ! )

source§

impl<T: NestedEncode, const N: usize> TopEncode for [T; N]

source§

fn top_encode<O: TopEncodeOutput>(&self, output: O) -> Result<(), EncodeError>

source§

fn top_encode_or_exit<O: TopEncodeOutput, ExitCtx: Clone>( &self, output: O, c: ExitCtx, exit: fn(_: ExitCtx, _: EncodeError) -> ! )

source§

impl<T: TopEncode> TopEncode for &T

source§

fn top_encode<O: TopEncodeOutput>(&self, output: O) -> Result<(), EncodeError>

source§

fn top_encode_or_exit<O: TopEncodeOutput, ExitCtx: Clone>( &self, output: O, c: ExitCtx, exit: fn(_: ExitCtx, _: EncodeError) -> ! )

source§

impl<T: TopEncode> TopEncode for Box<T>

source§

fn top_encode<O: TopEncodeOutput>(&self, output: O) -> Result<(), EncodeError>

source§

fn top_encode_or_exit<O: TopEncodeOutput, ExitCtx: Clone>( &self, output: O, c: ExitCtx, exit: fn(_: ExitCtx, _: EncodeError) -> ! )

Implementors§