Skip to main content

DecodeBytes

Trait DecodeBytes 

Source
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§

Source

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

Provided Methods§

Source

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§

Source§

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

Available on crate feature derive only.
Source§

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

Source§

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

Available on crate features alloc and derive only.
Source§

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

Source§

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

Available on crate features alloc and derive only.
Source§

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

Available on crate feature derive only.
Source§

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

Source§

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

Source§

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

Available on crate feature derive only.
Source§

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

Implementors§

Source§

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

Available on crate feature derive only.
Source§

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

Available on crate features alloc and derive only.
Source§

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

Available on crate feature derive only.