Trait Decode

Source
pub trait Decode<'a> {
    type Value: Sized;

    // Required methods
    fn decode(buf: &'a [u8]) -> Result<(Self::Value, &'a [u8]), Error>;
    fn decode_with_format(
        format: Format,
        buf: &'a [u8],
    ) -> Result<(Self::Value, &'a [u8]), Error>;
}

Required Associated Types§

Required Methods§

Source

fn decode(buf: &'a [u8]) -> Result<(Self::Value, &'a [u8]), Error>

Source

fn decode_with_format( format: Format, buf: &'a [u8], ) -> Result<(Self::Value, &'a [u8]), Error>

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> Decode<'a> for &'a str

Source§

type Value = &'a str

Source§

fn decode(buf: &'a [u8]) -> Result<(Self::Value, &'a [u8]), Error>

Source§

fn decode_with_format( format: Format, buf: &'a [u8], ) -> Result<(Self::Value, &'a [u8]), Error>

Source§

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

Source§

type Value = &'a [u8]

Source§

fn decode(buf: &'a [u8]) -> Result<(Self::Value, &'a [u8]), Error>

Source§

fn decode_with_format( format: Format, buf: &'a [u8], ) -> Result<(Self::Value, &'a [u8]), Error>

Source§

impl<'a> Decode<'a> for bool

Source§

type Value = bool

Source§

fn decode(buf: &'a [u8]) -> Result<(Self::Value, &'a [u8]), Error>

Source§

fn decode_with_format( format: Format, buf: &'a [u8], ) -> Result<(Self::Value, &'a [u8]), Error>

Source§

impl<'a> Decode<'a> for f32

Source§

type Value = f32

Source§

fn decode(buf: &[u8]) -> Result<(Self::Value, &[u8]), Error>

Source§

fn decode_with_format( format: Format, buf: &[u8], ) -> Result<(Self::Value, &[u8]), Error>

Source§

impl<'a> Decode<'a> for f64

Source§

type Value = f64

Source§

fn decode(buf: &[u8]) -> Result<(Self::Value, &[u8]), Error>

Source§

fn decode_with_format( format: Format, buf: &[u8], ) -> Result<(Self::Value, &[u8]), Error>

Source§

impl<'a> Decode<'a> for i8

Source§

type Value = i8

Source§

fn decode(buf: &'a [u8]) -> Result<(Self::Value, &'a [u8]), Error>

Source§

fn decode_with_format( format: Format, buf: &'a [u8], ) -> Result<(Self::Value, &'a [u8]), Error>

Source§

impl<'a> Decode<'a> for i16

Source§

type Value = i16

Source§

fn decode(buf: &'a [u8]) -> Result<(Self::Value, &'a [u8]), Error>

Source§

fn decode_with_format( format: Format, buf: &'a [u8], ) -> Result<(Self::Value, &'a [u8]), Error>

Source§

impl<'a> Decode<'a> for i32

Source§

type Value = i32

Source§

fn decode(buf: &'a [u8]) -> Result<(Self::Value, &'a [u8]), Error>

Source§

fn decode_with_format( format: Format, buf: &'a [u8], ) -> Result<(Self::Value, &'a [u8]), Error>

Source§

impl<'a> Decode<'a> for i64

Source§

type Value = i64

Source§

fn decode(buf: &'a [u8]) -> Result<(Self::Value, &'a [u8]), Error>

Source§

fn decode_with_format( format: Format, buf: &'a [u8], ) -> Result<(Self::Value, &'a [u8]), Error>

Source§

impl<'a> Decode<'a> for u8

Source§

type Value = u8

Source§

fn decode(buf: &'a [u8]) -> Result<(Self::Value, &'a [u8]), Error>

Source§

fn decode_with_format( format: Format, buf: &'a [u8], ) -> Result<(Self::Value, &'a [u8]), Error>

Source§

impl<'a> Decode<'a> for u16

Source§

type Value = u16

Source§

fn decode(buf: &'a [u8]) -> Result<(Self::Value, &'a [u8]), Error>

Source§

fn decode_with_format( format: Format, buf: &'a [u8], ) -> Result<(Self::Value, &'a [u8]), Error>

Source§

impl<'a> Decode<'a> for u32

Source§

type Value = u32

Source§

fn decode(buf: &'a [u8]) -> Result<(Self::Value, &'a [u8]), Error>

Source§

fn decode_with_format( format: Format, buf: &'a [u8], ) -> Result<(Self::Value, &'a [u8]), Error>

Source§

impl<'a> Decode<'a> for u64

Source§

type Value = u64

Source§

fn decode(buf: &'a [u8]) -> Result<(Self::Value, &'a [u8]), Error>

Source§

fn decode_with_format( format: Format, buf: &'a [u8], ) -> Result<(Self::Value, &'a [u8]), Error>

Source§

impl<'a> Decode<'a> for ()

Source§

type Value = ()

Source§

fn decode(buf: &'a [u8]) -> Result<(Self::Value, &'a [u8]), Error>

Source§

fn decode_with_format( format: Format, buf: &'a [u8], ) -> Result<(Self::Value, &'a [u8]), Error>

Source§

impl<'a, V> Decode<'a> for Option<V>
where V: Decode<'a>,

Source§

type Value = Option<<V as Decode<'a>>::Value>

Source§

fn decode(buf: &'a [u8]) -> Result<(Self::Value, &'a [u8]), Error>

Source§

fn decode_with_format( format: Format, buf: &'a [u8], ) -> Result<(Self::Value, &'a [u8]), Error>

Implementors§

Source§

impl<'a> Decode<'a> for Format

Source§

impl<'a> Decode<'a> for BinDecoder

Source§

type Value = &'a [u8]

Source§

impl<'a> Decode<'a> for ExtensionDecoder

Source§

impl<'a> Decode<'a> for NilDecoder

Source§

impl<'a> Decode<'a> for StrDecoder

Source§

type Value = &'a str

Source§

impl<'a, Array, V> Decode<'a> for ArrayDecoder<Array, V>
where V: Decode<'a>, Array: FromIterator<V::Value>,

Source§

type Value = Array

Source§

impl<'a, Map, K, V> Decode<'a> for MapDecoder<Map, K, V>
where K: Decode<'a>, V: Decode<'a>, Map: FromIterator<(K::Value, V::Value)>,

Source§

type Value = Map