Trait DecodeValue

Source
pub trait DecodeValue: Sized {
    // Required method
    fn decode_from(buffer: &[u8]) -> Result<(Self, &[u8])>;

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

This trait defines a type that can be decoded from bytes.

Required Methods§

Source

fn decode_from(buffer: &[u8]) -> Result<(Self, &[u8])>

Provided Methods§

Source

fn decode_from_exact(buffer: &[u8]) -> Result<Self>

decode a value from buffer, using all of the bytes.

If buffer was not entirely consumed, an error is returned.

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 DecodeValue for u8

Source§

fn decode_from(buffer: &[u8]) -> Result<(Self, &[u8])>

Source§

impl DecodeValue for u16

Source§

fn decode_from(buffer: &[u8]) -> Result<(Self, &[u8])>

Source§

impl DecodeValue for u32

Source§

fn decode_from(buffer: &[u8]) -> Result<(Self, &[u8])>

Source§

impl DecodeValue for u64

Source§

fn decode_from(buffer: &[u8]) -> Result<(Self, &[u8])>

Source§

impl<const L: usize> DecodeValue for [u8; L]

Source§

fn decode_from(buffer: &[u8]) -> Result<(Self, &[u8])>

Implementors§