Decode

Trait Decode 

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

A type that can be reconstructed (decoded) from a raw sequence of bytes.

Implementors of this trait define how to parse their binary representation from an input buffer. The input slice will be advanced by the number of bytes successfully consumed during decoding.

Required Methods§

Source

fn decode(data: &mut &[u8]) -> Result<Self, DecodeError>
where Self: Sized,

Attempts to decode Self from the beginning of the provided byte slice.

On success, returns the decoded value and advances data by the number of bytes consumed. On failure, returns a DecodeError.

§Errors

Returns a DecodeError if the input is malformed or insufficient to decode a complete value of this type.

Implementations on Foreign Types§

Source§

impl Decode for Option<DirectoryEntryReplyPayload>

Source§

fn decode(data: &mut &[u8]) -> Result<Self, DecodeError>

Source§

impl Decode for Option<FileMetadataReplyPayload>

Source§

fn decode(data: &mut &[u8]) -> Result<Self, DecodeError>

Source§

impl Decode for i8

Source§

fn decode(data: &mut &[u8]) -> Result<Self, DecodeError>

Source§

impl Decode for i16

Source§

fn decode(data: &mut &[u8]) -> Result<Self, DecodeError>

Source§

impl Decode for i32

Source§

fn decode(data: &mut &[u8]) -> Result<Self, DecodeError>

Source§

impl Decode for i64

Source§

fn decode(data: &mut &[u8]) -> Result<Self, DecodeError>

Source§

impl Decode for i128

Source§

fn decode(data: &mut &[u8]) -> Result<Self, DecodeError>

Source§

impl Decode for u8

Source§

fn decode(data: &mut &[u8]) -> Result<Self, DecodeError>

Source§

impl Decode for u16

Source§

fn decode(data: &mut &[u8]) -> Result<Self, DecodeError>

Source§

impl Decode for u32

Source§

fn decode(data: &mut &[u8]) -> Result<Self, DecodeError>

Source§

impl Decode for u64

Source§

fn decode(data: &mut &[u8]) -> Result<Self, DecodeError>

Source§

impl Decode for u128

Source§

fn decode(data: &mut &[u8]) -> Result<Self, DecodeError>

Source§

impl Decode for ()

Source§

fn decode(_data: &mut &[u8]) -> Result<Self, DecodeError>

Source§

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

Source§

fn decode(data: &mut &[u8]) -> Result<Self, DecodeError>

Implementors§