heed

Trait BytesDecode

Source
pub trait BytesDecode<'a> {
    type DItem: 'a;

    // Required method
    fn bytes_decode(
        bytes: &'a [u8],
    ) -> Result<Self::DItem, Box<dyn Error + Send + Sync>>;
}
Expand description

A trait that represents a decoding structure.

Required Associated Types§

Source

type DItem: 'a

The type to decode.

Required Methods§

Source

fn bytes_decode( bytes: &'a [u8], ) -> Result<Self::DItem, Box<dyn Error + Send + Sync>>

Decode the given bytes as DItem.

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 BytesDecode<'_> for DecodeIgnore

Source§

type DItem = ()

Source§

fn bytes_decode( _bytes: &[u8], ) -> Result<<DecodeIgnore as BytesDecode<'_>>::DItem, Box<dyn Error + Send + Sync>>

Source§

impl BytesDecode<'_> for Unit

Source§

type DItem = ()

Source§

fn bytes_decode( bytes: &[u8], ) -> Result<<Unit as BytesDecode<'_>>::DItem, Box<dyn Error + Send + Sync>>

Source§

impl BytesDecode<'_> for I8

Source§

type DItem = i8

Source§

fn bytes_decode( bytes: &[u8], ) -> Result<<I8 as BytesDecode<'_>>::DItem, Box<dyn Error + Send + Sync>>

Source§

impl BytesDecode<'_> for U8

Source§

type DItem = u8

Source§

fn bytes_decode( bytes: &[u8], ) -> Result<<U8 as BytesDecode<'_>>::DItem, Box<dyn Error + Send + Sync>>

Source§

impl<'a> BytesDecode<'a> for Bytes

Source§

type DItem = &'a [u8]

Source§

fn bytes_decode( bytes: &'a [u8], ) -> Result<<Bytes as BytesDecode<'a>>::DItem, Box<dyn Error + Send + Sync>>

Source§

impl<'a> BytesDecode<'a> for Str

Source§

type DItem = &'a str

Source§

fn bytes_decode( bytes: &'a [u8], ) -> Result<<Str as BytesDecode<'a>>::DItem, Box<dyn Error + Send + Sync>>

Source§

impl<'a, C> BytesDecode<'a> for LazyDecode<C>
where C: 'static,

Source§

type DItem = Lazy<'a, C>

Source§

fn bytes_decode( bytes: &'a [u8], ) -> Result<<LazyDecode<C> as BytesDecode<'a>>::DItem, Box<dyn Error + Send + Sync>>

Source§

impl<'a, T> BytesDecode<'a> for SerdeBincode<T>
where T: 'a + Deserialize<'a>,

Source§

type DItem = T

Source§

fn bytes_decode( bytes: &'a [u8], ) -> Result<<SerdeBincode<T> as BytesDecode<'a>>::DItem, Box<dyn Error + Send + Sync>>

Source§

impl<'a, T> BytesDecode<'a> for SerdeJson<T>
where T: 'a + Deserialize<'a>,

Source§

type DItem = T

Source§

fn bytes_decode( bytes: &'a [u8], ) -> Result<<SerdeJson<T> as BytesDecode<'a>>::DItem, Box<dyn Error + Send + Sync>>

Source§

impl<O> BytesDecode<'_> for I16<O>
where O: ByteOrder,

Source§

type DItem = i16

Source§

fn bytes_decode( bytes: &[u8], ) -> Result<<I16<O> as BytesDecode<'_>>::DItem, Box<dyn Error + Send + Sync>>

Source§

impl<O> BytesDecode<'_> for I32<O>
where O: ByteOrder,

Source§

type DItem = i32

Source§

fn bytes_decode( bytes: &[u8], ) -> Result<<I32<O> as BytesDecode<'_>>::DItem, Box<dyn Error + Send + Sync>>

Source§

impl<O> BytesDecode<'_> for I64<O>
where O: ByteOrder,

Source§

type DItem = i64

Source§

fn bytes_decode( bytes: &[u8], ) -> Result<<I64<O> as BytesDecode<'_>>::DItem, Box<dyn Error + Send + Sync>>

Source§

impl<O> BytesDecode<'_> for I128<O>
where O: ByteOrder,

Source§

type DItem = i128

Source§

fn bytes_decode( bytes: &[u8], ) -> Result<<I128<O> as BytesDecode<'_>>::DItem, Box<dyn Error + Send + Sync>>

Source§

impl<O> BytesDecode<'_> for U16<O>
where O: ByteOrder,

Source§

type DItem = u16

Source§

fn bytes_decode( bytes: &[u8], ) -> Result<<U16<O> as BytesDecode<'_>>::DItem, Box<dyn Error + Send + Sync>>

Source§

impl<O> BytesDecode<'_> for U32<O>
where O: ByteOrder,

Source§

type DItem = u32

Source§

fn bytes_decode( bytes: &[u8], ) -> Result<<U32<O> as BytesDecode<'_>>::DItem, Box<dyn Error + Send + Sync>>

Source§

impl<O> BytesDecode<'_> for U64<O>
where O: ByteOrder,

Source§

type DItem = u64

Source§

fn bytes_decode( bytes: &[u8], ) -> Result<<U64<O> as BytesDecode<'_>>::DItem, Box<dyn Error + Send + Sync>>

Source§

impl<O> BytesDecode<'_> for U128<O>
where O: ByteOrder,

Source§

type DItem = u128

Source§

fn bytes_decode( bytes: &[u8], ) -> Result<<U128<O> as BytesDecode<'_>>::DItem, Box<dyn Error + Send + Sync>>

Implementors§