Skip to main content

LeBytes

Trait LeBytes 

Source
pub trait LeBytes: Sized {
    type Bytes: AsRef<[u8]> + AsMut<[u8]> + Default + Copy;

    const ENCODED_SIZE: usize = _;

    // Required methods
    fn to_le_bytes(&self) -> Self::Bytes;
    fn from_le_bytes(bytes: Self::Bytes) -> Self;

    // Provided methods
    fn write_le(&self, dst: &mut [u8]) { ... }
    fn read_le(src: &[u8]) -> Self { ... }
}

Provided Associated Constants§

Required Associated Types§

Source

type Bytes: AsRef<[u8]> + AsMut<[u8]> + Default + Copy

Required Methods§

Source

fn to_le_bytes(&self) -> Self::Bytes

Source

fn from_le_bytes(bytes: Self::Bytes) -> Self

Provided Methods§

Source

fn write_le(&self, dst: &mut [u8])

Source

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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl LeBytes for bool

Source§

type Bytes = [u8; 1]

Source§

fn to_le_bytes(&self) -> Self::Bytes

Source§

fn from_le_bytes(bytes: Self::Bytes) -> Self

Source§

impl LeBytes for f32

Source§

type Bytes = [u8; 4]

Source§

fn to_le_bytes(&self) -> Self::Bytes

Source§

fn from_le_bytes(bytes: Self::Bytes) -> Self

Source§

impl LeBytes for f64

Source§

type Bytes = [u8; 8]

Source§

fn to_le_bytes(&self) -> Self::Bytes

Source§

fn from_le_bytes(bytes: Self::Bytes) -> Self

Source§

impl LeBytes for i8

Source§

type Bytes = [u8; 1]

Source§

fn to_le_bytes(&self) -> Self::Bytes

Source§

fn from_le_bytes(bytes: Self::Bytes) -> Self

Source§

impl LeBytes for i16

Source§

type Bytes = [u8; 2]

Source§

fn to_le_bytes(&self) -> Self::Bytes

Source§

fn from_le_bytes(bytes: Self::Bytes) -> Self

Source§

impl LeBytes for i32

Source§

type Bytes = [u8; 4]

Source§

fn to_le_bytes(&self) -> Self::Bytes

Source§

fn from_le_bytes(bytes: Self::Bytes) -> Self

Source§

impl LeBytes for i64

Source§

type Bytes = [u8; 8]

Source§

fn to_le_bytes(&self) -> Self::Bytes

Source§

fn from_le_bytes(bytes: Self::Bytes) -> Self

Source§

impl LeBytes for i128

Source§

type Bytes = [u8; 16]

Source§

fn to_le_bytes(&self) -> Self::Bytes

Source§

fn from_le_bytes(bytes: Self::Bytes) -> Self

Source§

impl LeBytes for u8

Source§

type Bytes = [u8; 1]

Source§

fn to_le_bytes(&self) -> Self::Bytes

Source§

fn from_le_bytes(bytes: Self::Bytes) -> Self

Source§

impl LeBytes for u16

Source§

type Bytes = [u8; 2]

Source§

fn to_le_bytes(&self) -> Self::Bytes

Source§

fn from_le_bytes(bytes: Self::Bytes) -> Self

Source§

impl LeBytes for u32

Source§

type Bytes = [u8; 4]

Source§

fn to_le_bytes(&self) -> Self::Bytes

Source§

fn from_le_bytes(bytes: Self::Bytes) -> Self

Source§

impl LeBytes for u64

Source§

type Bytes = [u8; 8]

Source§

fn to_le_bytes(&self) -> Self::Bytes

Source§

fn from_le_bytes(bytes: Self::Bytes) -> Self

Source§

impl LeBytes for u128

Source§

type Bytes = [u8; 16]

Source§

fn to_le_bytes(&self) -> Self::Bytes

Source§

fn from_le_bytes(bytes: Self::Bytes) -> Self

Implementors§