pub trait DecodeAsFields: Sized {
// Required method
fn decode_as_fields<'resolver, R: TypeResolver>(
input: &mut &[u8],
fields: &mut dyn FieldIter<'resolver, R::TypeId>,
types: &'resolver R,
) -> Result<Self, Error>;
}
Expand description
This is similar to DecodeAsType
, except that it’s instead implemented for types that can be given a list of
fields denoting the type being decoded from and attempt to do this decoding. This is generally implemented just
for tuple and struct types, and is automatically implemented via the DecodeAsType
macro.
Required Methods§
Sourcefn decode_as_fields<'resolver, R: TypeResolver>(
input: &mut &[u8],
fields: &mut dyn FieldIter<'resolver, R::TypeId>,
types: &'resolver R,
) -> Result<Self, Error>
fn decode_as_fields<'resolver, R: TypeResolver>( input: &mut &[u8], fields: &mut dyn FieldIter<'resolver, R::TypeId>, types: &'resolver R, ) -> Result<Self, Error>
Given some bytes and some fields denoting their structure, attempt to decode.
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.