Trait drt_sc_codec::TopEncodeOutput 
source · pub trait TopEncodeOutput: Sized {
    type NestedBuffer: NestedEncodeOutput;
    // Required methods
    fn set_slice_u8(self, bytes: &[u8]);
    fn start_nested_encode(&self) -> Self::NestedBuffer;
    fn finalize_nested_encode(self, nb: Self::NestedBuffer);
    // Provided methods
    fn set_u64(self, value: u64) { ... }
    fn set_i64(self, value: i64) { ... }
    fn supports_specialized_type<T: TryStaticCast>() -> bool { ... }
    fn set_specialized<T, H>(
        self,
        _value: &T,
        h: H,
    ) -> Result<(), H::HandledErr>
       where T: TryStaticCast,
             H: EncodeErrorHandler { ... }
}Expand description
Specifies objects that can receive the result of a TopEncode computation. in principle from NestedEncode performed on nested items.
All methods consume the object, so they can only be called once.
The trait is used in 3 scenarios:
- SC results
- #[storage_set(...)]
- Serialize async call.
Required Associated Types§
sourcetype NestedBuffer: NestedEncodeOutput
 
type NestedBuffer: NestedEncodeOutput
Type of NestedEncodeOutput that can be spawned to gather serializations of children.
Required Methods§
fn set_slice_u8(self, bytes: &[u8])
fn start_nested_encode(&self) -> Self::NestedBuffer
fn finalize_nested_encode(self, nb: Self::NestedBuffer)
Provided Methods§
fn set_u64(self, value: u64)
fn set_i64(self, value: i64)
fn supports_specialized_type<T: TryStaticCast>() -> bool
sourcefn set_specialized<T, H>(self, _value: &T, h: H) -> Result<(), H::HandledErr>where
    T: TryStaticCast,
    H: EncodeErrorHandler,
 
fn set_specialized<T, H>(self, _value: &T, h: H) -> Result<(), H::HandledErr>where
    T: TryStaticCast,
    H: EncodeErrorHandler,
Allows special handling of special types.
Also requires an alternative serialization, in case the special handling is not covered.
The alternative serialization, else_serialization is only called when necessary and
is normally compiled out via monomorphization.
Object Safety§
This trait is not object safe.