pub trait LittleEndianEncodeExt: Encode + Sized {
// Provided methods
fn u16_le(self, u: u16) -> impl Encode { ... }
fn u32_le(self, u: u32) -> impl Encode { ... }
fn u64_le(self, u: u64) -> impl Encode { ... }
fn u128_le(self, u: u128) -> impl Encode { ... }
fn usize_le(self, u: usize) -> impl Encode { ... }
}Expand description
Extension trait for encoding sequences with little-endian byte ordering.
Provided Methods§
Sourcefn u16_le(self, u: u16) -> impl Encode
fn u16_le(self, u: u16) -> impl Encode
Appends a u16 value to the encodable
sequence with little-endian byte ordering.
§Examples
use co::{EncodeExt, LittleEndianEncodeExt};
let mut code = [0; 2];
().u16_le(255).encode(&mut code);
assert_eq!(code, [0xFF, 0]);Sourcefn u32_le(self, u: u32) -> impl Encode
fn u32_le(self, u: u32) -> impl Encode
Appends a u32 value to the encodable
sequence with little-endian byte ordering.
§Examples
use co::{EncodeExt, LittleEndianEncodeExt};
let mut code = [0; 4];
().u32_le(255).encode(&mut code);
assert_eq!(code, [0xFF, 0, 0, 0]);Sourcefn u64_le(self, u: u64) -> impl Encode
fn u64_le(self, u: u64) -> impl Encode
Appends a u64 value to the encodable
sequence with little-endian byte ordering.
§Examples
use co::{EncodeExt, LittleEndianEncodeExt};
let mut code = [0; 8];
().u64_le(255).encode(&mut code);
assert_eq!(code, [0xFF, 0, 0, 0, 0, 0, 0, 0]);Sourcefn u128_le(self, u: u128) -> impl Encode
fn u128_le(self, u: u128) -> impl Encode
Appends a u128 value to the encodable
sequence with little-endian byte ordering.
§Examples
use co::{EncodeExt, LittleEndianEncodeExt};
let mut code = [0; 16];
().u128_le(255).encode(&mut code);
assert_eq!(code, [
0xFF, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
]);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.