Trait ac_node_api::DecodeAsType

source ·
pub trait DecodeAsType: Sized + IntoVisitor {
    // Provided method
    fn decode_as_type(
        input: &mut &[u8],
        type_id: u32,
        types: &PortableRegistry,
    ) -> Result<Self, Error> { ... }
}
Expand description

This trait is implemented for any type T where T implements IntoVisitor and the errors returned from this Visitor can be converted into Error. It’s essentially a convenience wrapper around visitor::decode_with_visitor that mirrors scale-encode’s EncodeAsType.

Provided Methods§

source

fn decode_as_type( input: &mut &[u8], type_id: u32, types: &PortableRegistry, ) -> Result<Self, Error>

Given some input bytes, a type_id, and type registry, attempt to decode said bytes into Self. Implementations should modify the &mut reference to the bytes such that any bytes not used in the course of decoding are still pointed to after decoding is complete.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T> DecodeAsType for T
where T: IntoVisitor,