pub trait Decode<'a>: Sized {
    type Output: Debug;
    type Error: From<Error> + Debug;

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

Decode trait implemented for binary decodable objects

Required Associated Types§

source

type Output: Debug

Output type (allows attaching lifetime bounds where required)

source

type Error: From<Error> + Debug

Error type returned on parse error

Required Methods§

source

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

Decode consumes a slice and returns an object and decoded length.

Implementors§

source§

impl<'a, T: DecodeOwned> Decode<'a> for T

Blanket Decode impl for DecodeOwned types

§

type Output = <T as DecodeOwned>::Output

§

type Error = <T as DecodeOwned>::Error