pub trait TopEncode: Sized {
// Provided methods
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 as EncodeErrorHandler>::HandledErr>
where O: TopEncodeOutput,
H: EncodeErrorHandler { ... }
}
Provided Methods§
Sourcefn top_encode<O>(&self, output: O) -> Result<(), EncodeError>where
O: TopEncodeOutput,
fn top_encode<O>(&self, output: O) -> Result<(), EncodeError>where
O: TopEncodeOutput,
Attempt to serialize the value to ouput.
Sourcefn top_encode_or_handle_err<O, H>(
&self,
output: O,
h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeOutput,
H: EncodeErrorHandler,
fn top_encode_or_handle_err<O, H>(
&self,
output: O,
h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeOutput,
H: EncodeErrorHandler,
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.
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.
Implementations on Foreign Types§
Source§impl TopEncode for &str
impl TopEncode for &str
fn top_encode_or_handle_err<O, H>(
&self,
output: O,
_h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeOutput,
H: EncodeErrorHandler,
Source§impl TopEncode for bool
impl TopEncode for bool
fn top_encode_or_handle_err<O, H>(
&self,
output: O,
_h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeOutput,
H: EncodeErrorHandler,
Source§impl TopEncode for i8
impl TopEncode for i8
fn top_encode_or_handle_err<O, H>(
&self,
output: O,
_h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeOutput,
H: EncodeErrorHandler,
Source§impl TopEncode for i16
impl TopEncode for i16
fn top_encode_or_handle_err<O, H>(
&self,
output: O,
_h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeOutput,
H: EncodeErrorHandler,
Source§impl TopEncode for i32
impl TopEncode for i32
fn top_encode_or_handle_err<O, H>(
&self,
output: O,
_h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeOutput,
H: EncodeErrorHandler,
Source§impl TopEncode for i64
impl TopEncode for i64
fn top_encode_or_handle_err<O, H>(
&self,
output: O,
_h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeOutput,
H: EncodeErrorHandler,
Source§impl TopEncode for isize
impl TopEncode for isize
fn top_encode_or_handle_err<O, H>(
&self,
output: O,
_h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeOutput,
H: EncodeErrorHandler,
Source§impl TopEncode for u8
impl TopEncode for u8
fn top_encode_or_handle_err<O, H>(
&self,
output: O,
_h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeOutput,
H: EncodeErrorHandler,
Source§impl TopEncode for u16
impl TopEncode for u16
fn top_encode_or_handle_err<O, H>(
&self,
output: O,
_h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeOutput,
H: EncodeErrorHandler,
Source§impl TopEncode for u32
impl TopEncode for u32
fn top_encode_or_handle_err<O, H>(
&self,
output: O,
_h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeOutput,
H: EncodeErrorHandler,
Source§impl TopEncode for u64
impl TopEncode for u64
fn top_encode_or_handle_err<O, H>(
&self,
output: O,
_h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeOutput,
H: EncodeErrorHandler,
Source§impl TopEncode for usize
impl TopEncode for usize
fn top_encode_or_handle_err<O, H>(
&self,
output: O,
_h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeOutput,
H: EncodeErrorHandler,
Source§impl TopEncode for NonZero<usize>
impl TopEncode for NonZero<usize>
fn top_encode_or_handle_err<O, H>(
&self,
output: O,
h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeOutput,
H: EncodeErrorHandler,
Source§impl TopEncode for HeapAddress
impl TopEncode for HeapAddress
fn top_encode_or_handle_err<O, H>(
&self,
output: O,
h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeOutput,
H: EncodeErrorHandler,
Source§impl TopEncode for HeapH256
impl TopEncode for HeapH256
fn top_encode_or_handle_err<O, H>(
&self,
output: O,
_h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeOutput,
H: EncodeErrorHandler,
Source§impl<T0> TopEncode for (T0,)where
T0: NestedEncode,
impl<T0> TopEncode for (T0,)where
T0: NestedEncode,
fn top_encode_or_handle_err<O, H>(
&self,
output: O,
h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeOutput,
H: EncodeErrorHandler,
Source§impl<T0, T1> TopEncode for (T0, T1)where
T0: NestedEncode,
T1: NestedEncode,
impl<T0, T1> TopEncode for (T0, T1)where
T0: NestedEncode,
T1: NestedEncode,
fn top_encode_or_handle_err<O, H>(
&self,
output: O,
h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeOutput,
H: EncodeErrorHandler,
Source§impl<T0, T1, T2> TopEncode for (T0, T1, T2)
impl<T0, T1, T2> TopEncode for (T0, T1, T2)
fn top_encode_or_handle_err<O, H>(
&self,
output: O,
h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeOutput,
H: EncodeErrorHandler,
Source§impl<T0, T1, T2, T3> TopEncode for (T0, T1, T2, T3)
impl<T0, T1, T2, T3> TopEncode for (T0, T1, T2, T3)
fn top_encode_or_handle_err<O, H>(
&self,
output: O,
h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeOutput,
H: EncodeErrorHandler,
Source§impl<T0, T1, T2, T3, T4> TopEncode for (T0, T1, T2, T3, T4)
impl<T0, T1, T2, T3, T4> TopEncode for (T0, T1, T2, T3, T4)
fn top_encode_or_handle_err<O, H>(
&self,
output: O,
h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeOutput,
H: EncodeErrorHandler,
Source§impl<T0, T1, T2, T3, T4, T5> TopEncode for (T0, T1, T2, T3, T4, T5)where
T0: NestedEncode,
T1: NestedEncode,
T2: NestedEncode,
T3: NestedEncode,
T4: NestedEncode,
T5: NestedEncode,
impl<T0, T1, T2, T3, T4, T5> TopEncode for (T0, T1, T2, T3, T4, T5)where
T0: NestedEncode,
T1: NestedEncode,
T2: NestedEncode,
T3: NestedEncode,
T4: NestedEncode,
T5: NestedEncode,
fn top_encode_or_handle_err<O, H>(
&self,
output: O,
h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeOutput,
H: EncodeErrorHandler,
Source§impl<T0, T1, T2, T3, T4, T5, T6> TopEncode for (T0, T1, T2, T3, T4, T5, T6)where
T0: NestedEncode,
T1: NestedEncode,
T2: NestedEncode,
T3: NestedEncode,
T4: NestedEncode,
T5: NestedEncode,
T6: NestedEncode,
impl<T0, T1, T2, T3, T4, T5, T6> TopEncode for (T0, T1, T2, T3, T4, T5, T6)where
T0: NestedEncode,
T1: NestedEncode,
T2: NestedEncode,
T3: NestedEncode,
T4: NestedEncode,
T5: NestedEncode,
T6: NestedEncode,
fn top_encode_or_handle_err<O, H>(
&self,
output: O,
h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeOutput,
H: EncodeErrorHandler,
Source§impl<T0, T1, T2, T3, T4, T5, T6, T7> TopEncode for (T0, T1, T2, T3, T4, T5, T6, T7)where
T0: NestedEncode,
T1: NestedEncode,
T2: NestedEncode,
T3: NestedEncode,
T4: NestedEncode,
T5: NestedEncode,
T6: NestedEncode,
T7: NestedEncode,
impl<T0, T1, T2, T3, T4, T5, T6, T7> TopEncode for (T0, T1, T2, T3, T4, T5, T6, T7)where
T0: NestedEncode,
T1: NestedEncode,
T2: NestedEncode,
T3: NestedEncode,
T4: NestedEncode,
T5: NestedEncode,
T6: NestedEncode,
T7: NestedEncode,
fn top_encode_or_handle_err<O, H>(
&self,
output: O,
h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeOutput,
H: EncodeErrorHandler,
Source§impl<T0, T1, T2, T3, T4, T5, T6, T7, T8> TopEncode for (T0, T1, T2, T3, T4, T5, T6, T7, T8)where
T0: NestedEncode,
T1: NestedEncode,
T2: NestedEncode,
T3: NestedEncode,
T4: NestedEncode,
T5: NestedEncode,
T6: NestedEncode,
T7: NestedEncode,
T8: NestedEncode,
impl<T0, T1, T2, T3, T4, T5, T6, T7, T8> TopEncode for (T0, T1, T2, T3, T4, T5, T6, T7, T8)where
T0: NestedEncode,
T1: NestedEncode,
T2: NestedEncode,
T3: NestedEncode,
T4: NestedEncode,
T5: NestedEncode,
T6: NestedEncode,
T7: NestedEncode,
T8: NestedEncode,
fn top_encode_or_handle_err<O, H>(
&self,
output: O,
h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeOutput,
H: EncodeErrorHandler,
Source§impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> TopEncode for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)where
T0: NestedEncode,
T1: NestedEncode,
T2: NestedEncode,
T3: NestedEncode,
T4: NestedEncode,
T5: NestedEncode,
T6: NestedEncode,
T7: NestedEncode,
T8: NestedEncode,
T9: NestedEncode,
impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> TopEncode for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)where
T0: NestedEncode,
T1: NestedEncode,
T2: NestedEncode,
T3: NestedEncode,
T4: NestedEncode,
T5: NestedEncode,
T6: NestedEncode,
T7: NestedEncode,
T8: NestedEncode,
T9: NestedEncode,
fn top_encode_or_handle_err<O, H>(
&self,
output: O,
h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeOutput,
H: EncodeErrorHandler,
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)where
T0: NestedEncode,
T1: NestedEncode,
T2: NestedEncode,
T3: NestedEncode,
T4: NestedEncode,
T5: NestedEncode,
T6: NestedEncode,
T7: NestedEncode,
T8: NestedEncode,
T9: NestedEncode,
T10: NestedEncode,
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)where
T0: NestedEncode,
T1: NestedEncode,
T2: NestedEncode,
T3: NestedEncode,
T4: NestedEncode,
T5: NestedEncode,
T6: NestedEncode,
T7: NestedEncode,
T8: NestedEncode,
T9: NestedEncode,
T10: NestedEncode,
fn top_encode_or_handle_err<O, H>(
&self,
output: O,
h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeOutput,
H: EncodeErrorHandler,
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)where
T0: NestedEncode,
T1: NestedEncode,
T2: NestedEncode,
T3: NestedEncode,
T4: NestedEncode,
T5: NestedEncode,
T6: NestedEncode,
T7: NestedEncode,
T8: NestedEncode,
T9: NestedEncode,
T10: NestedEncode,
T11: NestedEncode,
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)where
T0: NestedEncode,
T1: NestedEncode,
T2: NestedEncode,
T3: NestedEncode,
T4: NestedEncode,
T5: NestedEncode,
T6: NestedEncode,
T7: NestedEncode,
T8: NestedEncode,
T9: NestedEncode,
T10: NestedEncode,
T11: NestedEncode,
fn top_encode_or_handle_err<O, H>(
&self,
output: O,
h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeOutput,
H: EncodeErrorHandler,
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)where
T0: NestedEncode,
T1: NestedEncode,
T2: NestedEncode,
T3: NestedEncode,
T4: NestedEncode,
T5: NestedEncode,
T6: NestedEncode,
T7: NestedEncode,
T8: NestedEncode,
T9: NestedEncode,
T10: NestedEncode,
T11: NestedEncode,
T12: NestedEncode,
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)where
T0: NestedEncode,
T1: NestedEncode,
T2: NestedEncode,
T3: NestedEncode,
T4: NestedEncode,
T5: NestedEncode,
T6: NestedEncode,
T7: NestedEncode,
T8: NestedEncode,
T9: NestedEncode,
T10: NestedEncode,
T11: NestedEncode,
T12: NestedEncode,
fn top_encode_or_handle_err<O, H>(
&self,
output: O,
h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeOutput,
H: EncodeErrorHandler,
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)where
T0: NestedEncode,
T1: NestedEncode,
T2: NestedEncode,
T3: NestedEncode,
T4: NestedEncode,
T5: NestedEncode,
T6: NestedEncode,
T7: NestedEncode,
T8: NestedEncode,
T9: NestedEncode,
T10: NestedEncode,
T11: NestedEncode,
T12: NestedEncode,
T13: NestedEncode,
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)where
T0: NestedEncode,
T1: NestedEncode,
T2: NestedEncode,
T3: NestedEncode,
T4: NestedEncode,
T5: NestedEncode,
T6: NestedEncode,
T7: NestedEncode,
T8: NestedEncode,
T9: NestedEncode,
T10: NestedEncode,
T11: NestedEncode,
T12: NestedEncode,
T13: NestedEncode,
fn top_encode_or_handle_err<O, H>(
&self,
output: O,
h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeOutput,
H: EncodeErrorHandler,
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)where
T0: NestedEncode,
T1: NestedEncode,
T2: NestedEncode,
T3: NestedEncode,
T4: NestedEncode,
T5: NestedEncode,
T6: NestedEncode,
T7: NestedEncode,
T8: NestedEncode,
T9: NestedEncode,
T10: NestedEncode,
T11: NestedEncode,
T12: NestedEncode,
T13: NestedEncode,
T14: NestedEncode,
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)where
T0: NestedEncode,
T1: NestedEncode,
T2: NestedEncode,
T3: NestedEncode,
T4: NestedEncode,
T5: NestedEncode,
T6: NestedEncode,
T7: NestedEncode,
T8: NestedEncode,
T9: NestedEncode,
T10: NestedEncode,
T11: NestedEncode,
T12: NestedEncode,
T13: NestedEncode,
T14: NestedEncode,
fn top_encode_or_handle_err<O, H>(
&self,
output: O,
h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeOutput,
H: EncodeErrorHandler,
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)where
T0: NestedEncode,
T1: NestedEncode,
T2: NestedEncode,
T3: NestedEncode,
T4: NestedEncode,
T5: NestedEncode,
T6: NestedEncode,
T7: NestedEncode,
T8: NestedEncode,
T9: NestedEncode,
T10: NestedEncode,
T11: NestedEncode,
T12: NestedEncode,
T13: NestedEncode,
T14: NestedEncode,
T15: NestedEncode,
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)where
T0: NestedEncode,
T1: NestedEncode,
T2: NestedEncode,
T3: NestedEncode,
T4: NestedEncode,
T5: NestedEncode,
T6: NestedEncode,
T7: NestedEncode,
T8: NestedEncode,
T9: NestedEncode,
T10: NestedEncode,
T11: NestedEncode,
T12: NestedEncode,
T13: NestedEncode,
T14: NestedEncode,
T15: NestedEncode,
fn top_encode_or_handle_err<O, H>(
&self,
output: O,
h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeOutput,
H: EncodeErrorHandler,
Source§impl<T> TopEncode for &[T]where
T: NestedEncode,
impl<T> TopEncode for &[T]where
T: NestedEncode,
fn top_encode_or_handle_err<O, H>(
&self,
output: O,
h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeOutput,
H: EncodeErrorHandler,
Source§impl<T> TopEncode for Option<T>where
T: NestedEncode,
impl<T> TopEncode for Option<T>where
T: NestedEncode,
Source§fn top_encode_or_handle_err<O, H>(
&self,
output: O,
h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeOutput,
H: EncodeErrorHandler,
fn top_encode_or_handle_err<O, H>(
&self,
output: O,
h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeOutput,
H: EncodeErrorHandler,
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> TopEncode for &Twhere
T: TopEncode,
impl<T> TopEncode for &Twhere
T: TopEncode,
fn top_encode_or_handle_err<O, H>(
&self,
output: O,
h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeOutput,
H: EncodeErrorHandler,
Source§impl<T> TopEncode for PhantomData<T>
Empty structure with an empty bytes representation. Equivalent to false
, 0
or [u8; 0]
, but more explicit.
impl<T> TopEncode for PhantomData<T>
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.