DecodedTagged

Trait DecodedTagged 

Source
pub trait DecodedTagged<'a> {
    type Output: Debug;
    type Error: Debug;

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

Decode helper trait for for fields with external length tags (length must be specified via #[encdec(length=...)] macro)

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_len(buff: &'a [u8], len: usize) -> Result<Self::Output, Self::Error>

Decode consumes a slice and explicit length 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.

Implementations on Foreign Types§

Source§

impl<'a> DecodedTagged<'a> for &str

DecodedTagged impl for string slices (&str) (requires #[encdec(length=...)] length delimiter)

Source§

type Output = &'a str

Source§

type Error = Error

Source§

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

Source§

impl<'a> DecodedTagged<'a> for &[u8]

DecodedTagged impl for byte arrays (requires #[encdec(length=...)] length delimiter)

Source§

type Output = &'a [u8]

Source§

type Error = Error

Source§

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

Implementors§