Le

Trait Le 

Source
pub trait Le: Copy + Default {
    const SIZE: usize;

    // Required methods
    fn read_le(b: &[u8]) -> Self;
    fn write_le(self, out: &mut [u8]);
}
Expand description

Fixed-size little-endian value. read_le/write_le require a slice of exactly SIZE bytes.

Required Associated Constants§

Required Methods§

Source

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

Source

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

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 Le for bool

1 byte ([bool] elements, bool inside a struct). Spec §5.3 / §6.3: the writer writes 00 or 01; the reader reads 00 as false and any other value as true.

Not used for a bool table field: that one has no slot, only 2 bits (presence + value, spec §4.4), written with TableW::set_bool / FixedW::set_bool and read with TableRef::bool. This 1-byte form is only for struct fields and [bool] elements.

Source§

const SIZE: usize = 1

Source§

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

Source§

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

Source§

impl Le for f32

Source§

const SIZE: usize

Source§

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

Source§

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

Source§

impl Le for f64

Source§

const SIZE: usize

Source§

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

Source§

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

Source§

impl Le for i8

Source§

const SIZE: usize

Source§

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

Source§

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

Source§

impl Le for i16

Source§

const SIZE: usize

Source§

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

Source§

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

Source§

impl Le for i32

Source§

const SIZE: usize

Source§

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

Source§

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

Source§

impl Le for i64

Source§

const SIZE: usize

Source§

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

Source§

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

Source§

impl Le for i128

Source§

const SIZE: usize

Source§

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

Source§

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

Source§

impl Le for u8

Source§

const SIZE: usize

Source§

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

Source§

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

Source§

impl Le for u16

Source§

const SIZE: usize

Source§

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

Source§

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

Source§

impl Le for u32

Source§

const SIZE: usize

Source§

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

Source§

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

Source§

impl Le for u64

Source§

const SIZE: usize

Source§

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

Source§

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

Source§

impl Le for u128

Source§

const SIZE: usize

Source§

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

Source§

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

Implementors§