Trait LittleEndianConvert

Source
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.

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 LittleEndianConvert for f32

Source§

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 f64

Source§

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

Source§

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

Source§

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 i32

Source§

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

Source§

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

Source§

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

Source§

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 u32

Source§

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 u64

Source§

type Bytes = [u8; 8]

Source§

fn into_le_bytes(self) -> Self::Bytes

Source§

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

Implementors§