pub trait LittleEndianConvert {
    type Bytes: Default + AsRef<[u8]> + AsMut<[u8]>;

    // Required methods
    fn into_le_bytes(self) -> Self::Bytes;
    fn from_le_bytes(bytes: Self::Bytes) -> Self;
}
Expand description

Types that can be converted from and to little endian bytes.

Required Associated Types§

source

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

The little endian bytes representation.

Required Methods§

source

fn into_le_bytes(self) -> Self::Bytes

Converts self into little endian bytes.

source

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

Converts little endian bytes into Self.

Implementations on Foreign Types§

source§

impl LittleEndianConvert for u32

§

type Bytes = [u8; 4]

source§

fn into_le_bytes(self) -> Self::Bytes

source§

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

source§

impl LittleEndianConvert for i32

§

type Bytes = [u8; 4]

source§

fn into_le_bytes(self) -> Self::Bytes

source§

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

source§

impl LittleEndianConvert for i64

§

type Bytes = [u8; 8]

source§

fn into_le_bytes(self) -> Self::Bytes

source§

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

source§

impl LittleEndianConvert for f64

§

type Bytes = [u8; 8]

source§

fn into_le_bytes(self) -> Self::Bytes

source§

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

source§

impl LittleEndianConvert for u8

§

type Bytes = [u8; 1]

source§

fn into_le_bytes(self) -> Self::Bytes

source§

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

source§

impl LittleEndianConvert for u16

§

type Bytes = [u8; 2]

source§

fn into_le_bytes(self) -> Self::Bytes

source§

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

source§

impl LittleEndianConvert for u64

§

type Bytes = [u8; 8]

source§

fn into_le_bytes(self) -> Self::Bytes

source§

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

source§

impl LittleEndianConvert for i8

§

type Bytes = [u8; 1]

source§

fn into_le_bytes(self) -> Self::Bytes

source§

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

source§

impl LittleEndianConvert for i16

§

type Bytes = [u8; 2]

source§

fn into_le_bytes(self) -> Self::Bytes

source§

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

source§

impl LittleEndianConvert for f32

§

type Bytes = [u8; 4]

source§

fn into_le_bytes(self) -> Self::Bytes

source§

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

Implementors§