Trait gsdk::gp::DecodeAsType

pub trait DecodeAsType: Sized + IntoVisitor {
    // Provided method
    fn decode_as_type<R>(
        input: &mut &[u8],
        type_id: <R as TypeResolver>::TypeId,
        types: &R,
    ) -> Result<Self, Error>
       where R: TypeResolver { ... }
}
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§

fn decode_as_type<R>( input: &mut &[u8], type_id: <R as TypeResolver>::TypeId, types: &R, ) -> Result<Self, Error>
where R: TypeResolver,

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§

§

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