pub trait Endian: Debug + Default + Clone + Copy + PartialEq + Eq + 'static {
Show 28 methods fn from_big_endian(big_endian: bool) -> Option<Self>;
fn is_big_endian(self) -> bool; fn from_little_endian(little_endian: bool) -> Option<Self> { ... }
fn is_little_endian(self) -> bool { ... }
fn read_u16(self, n: u16) -> u16 { ... }
fn read_u32(self, n: u32) -> u32 { ... }
fn read_u64(self, n: u64) -> u64 { ... }
fn read_i16(self, n: i16) -> i16 { ... }
fn read_i32(self, n: i32) -> i32 { ... }
fn read_i64(self, n: i64) -> i64 { ... }
fn read_u16_bytes(self, n: [u8; 2]) -> u16 { ... }
fn read_u32_bytes(self, n: [u8; 4]) -> u32 { ... }
fn read_u64_bytes(self, n: [u8; 8]) -> u64 { ... }
fn read_i16_bytes(self, n: [u8; 2]) -> i16 { ... }
fn read_i32_bytes(self, n: [u8; 4]) -> i32 { ... }
fn read_i64_bytes(self, n: [u8; 8]) -> i64 { ... }
fn write_u16(self, n: u16) -> u16 { ... }
fn write_u32(self, n: u32) -> u32 { ... }
fn write_u64(self, n: u64) -> u64 { ... }
fn write_i16(self, n: i16) -> i16 { ... }
fn write_i32(self, n: i32) -> i32 { ... }
fn write_i64(self, n: i64) -> i64 { ... }
fn write_u16_bytes(self, n: u16) -> [u8; 2] { ... }
fn write_u32_bytes(self, n: u32) -> [u8; 4] { ... }
fn write_u64_bytes(self, n: u64) -> [u8; 8] { ... }
fn write_i16_bytes(self, n: i16) -> [u8; 2] { ... }
fn write_i32_bytes(self, n: i32) -> [u8; 4] { ... }
fn write_i64_bytes(self, n: i64) -> [u8; 8] { ... }
}
Expand description

A trait for using an endianness specification.

Provides methods for converting between the specified endianness and the native endianness of the target machine.

This trait does not require that the endianness is known at compile time.

Required methods

Construct a specification for the endianness of some values.

Returns None if the type does not support specifying the given endianness.

Return true for big endian byte order.

Provided methods

Construct a specification for the endianness of some values.

Returns None if the type does not support specifying the given endianness.

Return true for little endian byte order.

Converts an unsigned 16 bit integer to native endian.

Converts an unsigned 32 bit integer to native endian.

Converts an unsigned 64 bit integer to native endian.

Converts a signed 16 bit integer to native endian.

Converts a signed 32 bit integer to native endian.

Converts a signed 64 bit integer to native endian.

Converts an unaligned unsigned 16 bit integer to native endian.

Converts an unaligned unsigned 32 bit integer to native endian.

Converts an unaligned unsigned 64 bit integer to native endian.

Converts an unaligned signed 16 bit integer to native endian.

Converts an unaligned signed 32 bit integer to native endian.

Converts an unaligned signed 64 bit integer to native endian.

Converts an unsigned 16 bit integer from native endian.

Converts an unsigned 32 bit integer from native endian.

Converts an unsigned 64 bit integer from native endian.

Converts a signed 16 bit integer from native endian.

Converts a signed 32 bit integer from native endian.

Converts a signed 64 bit integer from native endian.

Converts an unaligned unsigned 16 bit integer from native endian.

Converts an unaligned unsigned 32 bit integer from native endian.

Converts an unaligned unsigned 64 bit integer from native endian.

Converts an unaligned signed 16 bit integer from native endian.

Converts an unaligned signed 32 bit integer from native endian.

Converts an unaligned signed 64 bit integer from native endian.

Implementors