FixedInt

Trait FixedInt 

Source
pub trait FixedInt<const S: usize>: Sized {
    // Required methods
    fn serialize(self) -> [u8; S];
    fn deserialize(bytes: &[u8]) -> Self;
}
Expand description

FixedInt

Required Methods§

Source

fn serialize(self) -> [u8; S]

Serialize self to fixed-size big-endian u8 array

Source

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

Deserialize from big-endian slice

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 FixedInt<1> for i8

Source§

fn serialize(self) -> [u8; 1]

Source§

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

Source§

impl FixedInt<1> for u8

Source§

fn serialize(self) -> [u8; 1]

Source§

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

Source§

impl FixedInt<2> for i16

Source§

fn serialize(self) -> [u8; 2]

Source§

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

Source§

impl FixedInt<2> for u16

Source§

fn serialize(self) -> [u8; 2]

Source§

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

Source§

impl FixedInt<4> for i32

Source§

fn serialize(self) -> [u8; 4]

Source§

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

Source§

impl FixedInt<4> for u32

Source§

fn serialize(self) -> [u8; 4]

Source§

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

Source§

impl FixedInt<8> for i64

Source§

fn serialize(self) -> [u8; 8]

Source§

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

Source§

impl FixedInt<8> for u64

Source§

fn serialize(self) -> [u8; 8]

Source§

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

Source§

impl FixedInt<16> for i128

Source§

fn serialize(self) -> [u8; 16]

Source§

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

Source§

impl FixedInt<16> for u128

Source§

fn serialize(self) -> [u8; 16]

Source§

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

Implementors§