ByteOrder

Trait ByteOrder 

Source
pub trait ByteOrder: Clone + Copy {
    // Required methods
    fn u16_from_bytes(self, bytes: [u8; 2]) -> u16;
    fn u16_to_bytes(self, value: u16) -> [u8; 2];
    fn u32_from_bytes(self, bytes: [u8; 4]) -> u32;
    fn u32_to_bytes(self, value: u32) -> [u8; 4];
    fn u64_from_bytes(self, bytes: [u8; 8]) -> u64;
}
Expand description

Represents a trait for byte order operations

Required Methods§

Source

fn u16_from_bytes(self, bytes: [u8; 2]) -> u16

Converts a byte array to a u16

Source

fn u16_to_bytes(self, value: u16) -> [u8; 2]

Source

fn u32_from_bytes(self, bytes: [u8; 4]) -> u32

Converts a byte array to a u32

Source

fn u32_to_bytes(self, value: u32) -> [u8; 4]

Source

fn u64_from_bytes(self, bytes: [u8; 8]) -> u64

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.

Implementors§