Skip to main content

Decode

Trait Decode 

Source
pub trait Decode: Sized {
    // Required method
    fn decode(data: &[u8]) -> Option<(Self, usize)>;
}
Expand description

Decode a value from a byte slice in conduit’s binary wire format.

Returns the decoded value together with the number of bytes consumed, or None if the data is too short or malformed.

Required Methods§

Source

fn decode(data: &[u8]) -> Option<(Self, usize)>

Attempt to decode from the start of data.

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 Decode for bool

Source§

fn decode(data: &[u8]) -> Option<(Self, usize)>

Source§

impl Decode for f32

Source§

fn decode(data: &[u8]) -> Option<(Self, usize)>

Source§

impl Decode for f64

Source§

fn decode(data: &[u8]) -> Option<(Self, usize)>

Source§

impl Decode for i8

Source§

fn decode(data: &[u8]) -> Option<(Self, usize)>

Source§

impl Decode for i16

Source§

fn decode(data: &[u8]) -> Option<(Self, usize)>

Source§

impl Decode for i32

Source§

fn decode(data: &[u8]) -> Option<(Self, usize)>

Source§

impl Decode for i64

Source§

fn decode(data: &[u8]) -> Option<(Self, usize)>

Source§

impl Decode for u8

Source§

fn decode(data: &[u8]) -> Option<(Self, usize)>

Source§

impl Decode for u16

Source§

fn decode(data: &[u8]) -> Option<(Self, usize)>

Source§

impl Decode for u32

Source§

fn decode(data: &[u8]) -> Option<(Self, usize)>

Source§

impl Decode for u64

Source§

fn decode(data: &[u8]) -> Option<(Self, usize)>

Source§

impl Decode for String

Source§

fn decode(data: &[u8]) -> Option<(Self, usize)>

Source§

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

Source§

fn decode(data: &[u8]) -> Option<(Self, usize)>

Implementors§