DecodePrefixed

Trait DecodePrefixed 

Source
pub trait DecodePrefixed<'a, P: Decode<'a>> {
    type Output: Debug;
    type Error: Debug;

    // Required method
    fn decode_prefixed(
        buff: &'a [u8],
    ) -> Result<(Self::Output, usize), Self::Error>;
}
Expand description

Decode helper trait for fields with length prefixes

Required Associated Types§

Source

type Output: Debug

Output type (required for lifetime bounds)

Source

type Error: Debug

Error type returned on parse error

Required Methods§

Source

fn decode_prefixed(buff: &'a [u8]) -> Result<(Self::Output, usize), Self::Error>

Decode consumes a slice and returns an object

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.

Implementors§

Source§

impl<'a, T, P> DecodePrefixed<'a, P> for T
where T: Decode<'a>, P: Decode<'a, Error = Error>, <P as Decode<'a>>::Output: AsPrimitive<usize>, <T as Decode<'a>>::Error: From<Error>,

Source§

type Output = <T as Decode<'a>>::Output

Source§

type Error = <T as Decode<'a>>::Error