ink_primitives::types

Trait FromLittleEndian

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

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

Allows to instantiate a type from its little-endian bytes representation.

Required Associated Types§

Source

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

The little-endian bytes representation.

Required Methods§

Source

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

Create a new instance from the little-endian bytes representation.

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 FromLittleEndian for u8

Source§

type Bytes = [u8; 1]

Source§

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

Source§

impl FromLittleEndian for u16

Source§

type Bytes = [u8; 2]

Source§

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

Source§

impl FromLittleEndian for u32

Source§

type Bytes = [u8; 4]

Source§

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

Source§

impl FromLittleEndian for u64

Source§

type Bytes = [u8; 8]

Source§

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

Source§

impl FromLittleEndian for u128

Source§

type Bytes = [u8; 16]

Source§

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

Implementors§