Trait Deserialize

Source
pub trait Deserialize {
    const SERIALIZED_SIZE: usize;

    // Required method
    fn deserialize(src: &[u8]) -> Self;
}
Expand description

Trait for describing how a type can be parsed from a constant-size byte slice.

Required Associated Constants§

Source

const SERIALIZED_SIZE: usize

The length of the buffer passed into Deserialize::deserialize.

Required Methods§

Source

fn deserialize(src: &[u8]) -> Self

Deserializes the byte buffer into the struct. The length of src must match the same type’s Deserialize::SERIALIZED_SIZE constant.

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 Deserialize for (u16, u16)

Source§

const SERIALIZED_SIZE: usize = 4usize

Source§

fn deserialize(src: &[u8]) -> Self

Source§

impl Deserialize for bool

Source§

const SERIALIZED_SIZE: usize = 1usize

Source§

fn deserialize(src: &[u8]) -> Self

Source§

impl Deserialize for u8

Source§

const SERIALIZED_SIZE: usize = 1usize

Source§

fn deserialize(src: &[u8]) -> Self

Source§

impl Deserialize for u16

Source§

const SERIALIZED_SIZE: usize = 2usize

Source§

fn deserialize(src: &[u8]) -> Self

Source§

impl Deserialize for u32

Source§

const SERIALIZED_SIZE: usize = 4usize

Source§

fn deserialize(src: &[u8]) -> Self

Source§

impl Deserialize for u64

Source§

const SERIALIZED_SIZE: usize = 8usize

Source§

fn deserialize(src: &[u8]) -> Self

Source§

impl Deserialize for Range<u32>

Source§

const SERIALIZED_SIZE: usize = 8usize

Source§

fn deserialize(src: &[u8]) -> Self

Source§

impl Deserialize for Range<u64>

Source§

const SERIALIZED_SIZE: usize = 16usize

Source§

fn deserialize(src: &[u8]) -> Self

Source§

impl<T: Deserialize, const LEN: usize> Deserialize for ArrayVec<T, LEN>

Source§

impl<const LEN: usize> Deserialize for ArrayString<LEN>

Implementors§