Skip to main content

Decode

Trait Decode 

Source
pub trait Decode: Sized {
    // Required method
    fn decode<R: Read>(reader: &mut R) -> Result<Self>;

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

Hardware and language independent decoding. Uses the Reader pattern for efficient decoding.

Required Methods§

Source

fn decode<R: Read>(reader: &mut R) -> Result<Self>

Reads and decodes a value from the given reader.

Provided Methods§

Source

fn decode_from_bytes(bytes: &[u8]) -> 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 String

Source§

fn decode<R: Read>(reader: &mut R) -> Result<Self>

Source§

impl Decode for bool

Source§

fn decode<R: Read>(reader: &mut R) -> Result<Self>

Source§

impl Decode for u8

Source§

fn decode<R: Read>(reader: &mut R) -> Result<Self>

Source§

impl Decode for u32

Source§

fn decode<R: Read>(reader: &mut R) -> Result<Self>

Source§

impl Decode for usize

Source§

fn decode<R: Read>(reader: &mut R) -> Result<Self>

Source§

impl<S: Decode, T: Decode> Decode for (S, T)

Source§

fn decode<R: Read>(reader: &mut R) -> Result<Self>

Source§

impl<T: Decode + Default, const N: usize> Decode for [T; N]

Source§

fn decode<R: Read>(reader: &mut R) -> Result<Self>

Source§

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

Source§

fn decode<R: Read>(reader: &mut R) -> Result<Self>

Source§

impl<T: Decode> Decode for Vec<T>

Source§

fn decode<R: Read>(reader: &mut R) -> Result<Self>

Implementors§