pub trait Encoding: Sized {
    type Repr: AsRef<[u8]> + AsMut<[u8]> + Copy + Clone + Sized;

    const BIT_SIZE: usize;
    const BYTE_SIZE: usize;

    fn from_be_bytes(bytes: Self::Repr) -> Self;
    fn from_le_bytes(bytes: Self::Repr) -> Self;
    fn to_be_bytes(&self) -> Self::Repr;
    fn to_le_bytes(&self) -> Self::Repr;
}
Expand description

Encoding support.

Required Associated Types§

Byte array representation.

Required Associated Constants§

Size of this integer in bits.

Size of this integer in bytes.

Required Methods§

Decode from big endian bytes.

Decode from little endian bytes.

Encode to big endian bytes.

Encode to little endian bytes.

Implementors§