Endianness

Trait Endianness 

Source
pub trait Endianness: Clone {
    // Required methods
    fn i8_to_bytes(sample: i8) -> [u8; 1];
    fn i16_to_bytes(sample: i16) -> [u8; 2];
    fn i24_to_bytes(sample: i32) -> [u8; 3];
    fn i32_to_bytes(sample: i32) -> [u8; 4];
    fn bytes_to_i8(bytes: [u8; 1]) -> i8;
    fn bytes_to_i16(bytes: [u8; 2]) -> i16;
    fn bytes_to_i24(bytes: [u8; 3]) -> i32;
    fn bytes_to_i32(bytes: [u8; 4]) -> i32;
    fn bytes_to_be(buf: &mut [u8], bytes_per_sample: usize);
    fn bytes_to_le(buf: &mut [u8], bytes_per_sample: usize);
}
Expand description

Sample byte order

Required Methods§

Source

fn i8_to_bytes(sample: i8) -> [u8; 1]

Converts 8-bit sample to bytes in this byte order

Source

fn i16_to_bytes(sample: i16) -> [u8; 2]

Converts 16-bit sample to bytes in this byte order

Source

fn i24_to_bytes(sample: i32) -> [u8; 3]

Converts 24-bit sample to bytes in this byte order

Source

fn i32_to_bytes(sample: i32) -> [u8; 4]

Converts 32-bit sample to bytes in this byte order

Source

fn bytes_to_i8(bytes: [u8; 1]) -> i8

Converts bytes to 8-bit samples in this byte order

Source

fn bytes_to_i16(bytes: [u8; 2]) -> i16

Converts bytes to 16-bit samples in this byte order

Source

fn bytes_to_i24(bytes: [u8; 3]) -> i32

Converts bytes to 24-bit samples in this byte order

Source

fn bytes_to_i32(bytes: [u8; 4]) -> i32

Converts bytes to 32-bit samples in this byte order

Source

fn bytes_to_be(buf: &mut [u8], bytes_per_sample: usize)

Converts bytes in this byte order to big-endian

Source

fn bytes_to_le(buf: &mut [u8], bytes_per_sample: usize)

Converts bytes in this byte order to little-endian

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§