Trait flexiber::Decodable

source ·
pub trait Decodable<'a>: Sized {
    // Required method
    fn decode(decoder: &mut Decoder<'a>) -> Result<Self>;

    // Provided method
    fn from_bytes(bytes: &'a [u8]) -> Result<Self> { ... }
}
Expand description

Decoding trait.

Decode out of decoder, which essentially is a slice of bytes.

One way to implement this trait is to implement TryFrom<TaggedSlice<'_>, Error = Error>.

Required Methods§

source

fn decode(decoder: &mut Decoder<'a>) -> Result<Self>

Attempt to decode this message using the provided decoder.

Provided Methods§

source

fn from_bytes(bytes: &'a [u8]) -> Result<Self>

Parse Self from the provided byte slice.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Decodable<'_> for [u8; 0]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 1]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 2]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 3]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 4]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 5]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 6]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 7]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 8]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 9]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 10]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 11]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 12]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 13]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 14]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 15]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 16]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 17]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 18]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 19]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 20]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 21]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 22]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 23]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 24]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 25]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 26]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 27]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 28]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 29]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 30]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 31]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl Decodable<'_> for [u8; 32]

source§

fn decode(decoder: &mut Decoder<'_>) -> Result<Self>

source§

impl<'a, T> Decodable<'a> for Option<T>
where T: Decodable<'a> + Tagged,

This implementation is quite gotcha-y, since only one byte is peeked.

It should evaluate to the desired tag via Tag::try_from(byte)?.

source§

fn decode(decoder: &mut Decoder<'a>) -> Result<Option<T>>

Implementors§

source§

impl Decodable<'_> for Length

source§

impl Decodable<'_> for SimpleTag

source§

impl Decodable<'_> for Tag

source§

impl<'a, T> Decodable<'a> for TaggedSlice<'a, T>
where T: Decodable<'a> + TagLike,

source§

impl<'a, X> Decodable<'a> for X
where X: TryFrom<TaggedSlice<'a>, Error = Error>,