Endianable

Trait Endianable 

Source
pub trait Endianable: Copy {
    // Required methods
    fn from_le(self) -> Self;
    fn from_be(self) -> Self;
    fn to_le(self) -> Self;
    fn to_be(self) -> Self;
}
Expand description

Trait for types that support endianness conversion.

This trait provides methods to convert values to and from little-endian (LE) and big-endian (BE) byte orders. It is implemented for most primitive integer and floating-point types.

Required Methods§

Source

fn from_le(self) -> Self

Converts a value from its little-endian representation to the native endianness.

Source

fn from_be(self) -> Self

Converts a value from its big-endian representation to the native endianness.

Source

fn to_le(self) -> Self

Converts a value from the native endianness to its little-endian representation.

Source

fn to_be(self) -> Self

Converts a value from the native endianness to its big-endian 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 Endianable for f32

Source§

fn from_le(self) -> Self

Source§

fn from_be(self) -> Self

Source§

fn to_le(self) -> Self

Source§

fn to_be(self) -> Self

Source§

impl Endianable for f64

Source§

fn from_le(self) -> Self

Source§

fn from_be(self) -> Self

Source§

fn to_le(self) -> Self

Source§

fn to_be(self) -> Self

Source§

impl Endianable for i8

Source§

fn from_le(self) -> Self

Source§

fn from_be(self) -> Self

Source§

fn to_le(self) -> Self

Source§

fn to_be(self) -> Self

Source§

impl Endianable for i16

Source§

fn from_le(self) -> Self

Source§

fn from_be(self) -> Self

Source§

fn to_le(self) -> Self

Source§

fn to_be(self) -> Self

Source§

impl Endianable for i32

Source§

fn from_le(self) -> Self

Source§

fn from_be(self) -> Self

Source§

fn to_le(self) -> Self

Source§

fn to_be(self) -> Self

Source§

impl Endianable for i64

Source§

fn from_le(self) -> Self

Source§

fn from_be(self) -> Self

Source§

fn to_le(self) -> Self

Source§

fn to_be(self) -> Self

Source§

impl Endianable for i128

Source§

fn from_le(self) -> Self

Source§

fn from_be(self) -> Self

Source§

fn to_le(self) -> Self

Source§

fn to_be(self) -> Self

Source§

impl Endianable for isize

Source§

fn from_le(self) -> Self

Source§

fn from_be(self) -> Self

Source§

fn to_le(self) -> Self

Source§

fn to_be(self) -> Self

Source§

impl Endianable for u8

Source§

fn from_le(self) -> Self

Source§

fn from_be(self) -> Self

Source§

fn to_le(self) -> Self

Source§

fn to_be(self) -> Self

Source§

impl Endianable for u16

Source§

fn from_le(self) -> Self

Source§

fn from_be(self) -> Self

Source§

fn to_le(self) -> Self

Source§

fn to_be(self) -> Self

Source§

impl Endianable for u32

Source§

fn from_le(self) -> Self

Source§

fn from_be(self) -> Self

Source§

fn to_le(self) -> Self

Source§

fn to_be(self) -> Self

Source§

impl Endianable for u64

Source§

fn from_le(self) -> Self

Source§

fn from_be(self) -> Self

Source§

fn to_le(self) -> Self

Source§

fn to_be(self) -> Self

Source§

impl Endianable for u128

Source§

fn from_le(self) -> Self

Source§

fn from_be(self) -> Self

Source§

fn to_le(self) -> Self

Source§

fn to_be(self) -> Self

Source§

impl Endianable for usize

Source§

fn from_le(self) -> Self

Source§

fn from_be(self) -> Self

Source§

fn to_le(self) -> Self

Source§

fn to_be(self) -> Self

Implementors§