Skip to main content

Decode

Trait Decode 

Source
pub trait Decode: Sized {
    // Required method
    fn decode(decoder: &mut Decoder<'_>) -> Result<Self>;

    // Provided method
    fn decode_sized(decoder: &mut Decoder<'_>, _size: usize) -> Result<Self> { ... }
}

Required Methods§

Source

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

This will take the decoder and return the data itself, parsed from the decoder’s input bytes.

Provided Methods§

Source

fn decode_sized(decoder: &mut Decoder<'_>, _size: usize) -> Result<Self>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Decode for DateTime<Local>

Source§

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

Source§

fn decode_sized(decoder: &mut Decoder<'_>, size: usize) -> Result<Self>

Source§

impl Decode for String

String based on the ASCII characters in the decoder, can be length 0-infinite.

Source§

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

Source§

fn decode_sized(decoder: &mut Decoder<'_>, size: usize) -> Result<Self>

Source§

impl Decode for bool

Values 0 and 1 only. Length is always 1.

Source§

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

Source§

fn decode_sized(decoder: &mut Decoder<'_>, size: usize) -> Result<Self>

Source§

impl Decode for char

Raw ASCII character, length 1

Source§

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

Source§

fn decode_sized(decoder: &mut Decoder<'_>, size: usize) -> Result<Self>

Source§

impl Decode for u8

Values ranging 0..256, length 1-3

Source§

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

Source§

fn decode_sized(decoder: &mut Decoder<'_>, size: usize) -> Result<Self>

Source§

impl Decode for u16

Values ranging 0..65536, length 1-5

Source§

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

Source§

fn decode_sized(decoder: &mut Decoder<'_>, size: usize) -> Result<Self>

Source§

impl Decode for u32

Values ranging 0..4294967296, length 1-10

Source§

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

Source§

fn decode_sized(decoder: &mut Decoder<'_>, size: usize) -> Result<Self>

Source§

impl Decode for u64

Values ranging 0..18446744073709551616, length 1-20

Source§

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

Source§

fn decode_sized(decoder: &mut Decoder<'_>, size: usize) -> Result<Self>

Source§

impl<T> Decode for Option<T>
where T: Decode,

Source§

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

Source§

fn decode_sized(decoder: &mut Decoder<'_>, size: usize) -> Result<Self>

Implementors§