DecodeBytes

Trait DecodeBytes 

pub trait DecodeBytes<'b, C>: Sized {
    // Required method
    fn decode_bytes(d: &mut Decoder<'b>, ctx: &mut C) -> Result<Self, Error>;

    // Provided method
    fn nil() -> Option<Self> { ... }
}
Expand description

Like Decode but specific for decoding from byte slices.

Required Methods§

fn decode_bytes(d: &mut Decoder<'b>, ctx: &mut C) -> Result<Self, Error>

Provided Methods§

fn nil() -> Option<Self>

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§

§

impl<'a, 'b, C> DecodeBytes<'b, C> for &'a [u8]
where 'b: 'a,

Available on crate feature derive only.
§

fn decode_bytes(d: &mut Decoder<'b>, _: &mut C) -> Result<&'a [u8], Error>

§

impl<'b, C> DecodeBytes<'b, C> for Cow<'_, [u8]>

Available on crate features alloc and derive only.
§

fn decode_bytes( d: &mut Decoder<'b>, ctx: &mut C, ) -> Result<Cow<'_, [u8]>, Error>

§

impl<'b, C> DecodeBytes<'b, C> for Vec<u8>

Available on crate features alloc and derive only.
§

fn decode_bytes(d: &mut Decoder<'b>, _: &mut C) -> Result<Vec<u8>, Error>

§

impl<'b, C, T> DecodeBytes<'b, C> for Option<T>
where T: DecodeBytes<'b, C>,

Available on crate feature derive only.
§

fn decode_bytes(d: &mut Decoder<'b>, ctx: &mut C) -> Result<Option<T>, Error>

§

fn nil() -> Option<Option<T>>

§

impl<'b, C, const N: usize> DecodeBytes<'b, C> for [u8; N]

Available on crate feature derive only.
§

fn decode_bytes(d: &mut Decoder<'b>, ctx: &mut C) -> Result<[u8; N], Error>

Implementors§

§

impl<'a, 'b, C> DecodeBytes<'b, C> for &'a ByteSlice
where 'b: 'a,

Available on crate feature derive only.
§

impl<'b, C> DecodeBytes<'b, C> for ByteVec

Available on crate features alloc and derive only.
§

impl<'b, C, const N: usize> DecodeBytes<'b, C> for ByteArray<N>

Available on crate feature derive only.