DecodableValues

Trait DecodableValues 

Source
pub trait DecodableValues {
    type Target;

    // Required methods
    fn decode_next_value<Resolver>(
        &mut self,
        input: &mut &[u8],
        type_id: Resolver::TypeId,
        types: &Resolver,
    ) -> Result<(), Error>
       where Resolver: TypeResolver;
    fn decoded_target(self) -> Self::Target;
}
Expand description

Implementors of this trait are capable of decoding multiple values from bytes into an output type such as a tuple or fixed size array.

Required Associated Types§

Source

type Target

The target that we will return after decoding multiple values.

Required Methods§

Source

fn decode_next_value<Resolver>( &mut self, input: &mut &[u8], type_id: Resolver::TypeId, types: &Resolver, ) -> Result<(), Error>
where Resolver: TypeResolver,

Decode the next value. This should be called exactly as many times as IntoDecodableValues::num_decodable_values, after which DecodableValues::decoded_target() can be called to return the decoded target value.

§Panics

This method may panic if it is called more times than IntoDecodableValues::num_decodable_values.

Source

fn decoded_target(self) -> Self::Target

Return the decoded target.

§Panics

This method may panic if DecodableValues::decode_next_value has not been called enough times.

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.

Implementations on Foreign Types§

Source§

impl DecodableValues for ()

Source§

type Target = ()

Source§

fn decode_next_value<Resolver>( &mut self, _input: &mut &[u8], _type_id: Resolver::TypeId, _types: &Resolver, ) -> Result<(), Error>
where Resolver: TypeResolver,

Source§

fn decoded_target(self) -> Self::Target

Source§

impl<T: DecodeAsType> DecodableValues for Vec<T>

Source§

type Target = Vec<T>

Source§

fn decode_next_value<Resolver>( &mut self, input: &mut &[u8], type_id: Resolver::TypeId, types: &Resolver, ) -> Result<(), Error>
where Resolver: TypeResolver,

Source§

fn decoded_target(self) -> Self::Target

Implementors§