Trait scale_decode::DecodeAsType
source · pub trait DecodeAsType: Sized {
// 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§
sourcefn decode_as_type(
input: &mut &[u8],
type_id: u32,
types: &PortableRegistry
) -> Result<Self, Error>
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.