Skip to main content

PrimSplit

Trait PrimSplit 

Source
pub trait PrimSplit<T, const LEN: usize> {
    // Required methods
    fn into_array_be(self) -> [T; LEN] ;
    fn into_array_le(self) -> [T; LEN] ;
    fn into_array_ne(self) -> [T; LEN] ;
}
Expand description

⚙️ Offers methods to split a primitive into an array of smaller primitives.


📍 num/grain


See also the Cast type for the equivalent const methods, and the PrimJoin trait for the opposite operations.

Required Methods§

Source

fn into_array_be(self) -> [T; LEN]

Splits self into an array of T in big-endian order.

Source

fn into_array_le(self) -> [T; LEN]

Splits self into an array of T in little-endian order.

Source

fn into_array_ne(self) -> [T; LEN]

Splits self into an array of T in native-endian order.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl PrimSplit<u8, 2> for u16

Source§

fn into_array_be(self) -> [u8; 2]

Source§

fn into_array_le(self) -> [u8; 2]

Source§

fn into_array_ne(self) -> [u8; 2]

Source§

impl PrimSplit<u8, 4> for u32

Source§

fn into_array_be(self) -> [u8; 4]

Source§

fn into_array_le(self) -> [u8; 4]

Source§

fn into_array_ne(self) -> [u8; 4]

Source§

impl PrimSplit<u8, 8> for u64

Source§

fn into_array_be(self) -> [u8; 8]

Source§

fn into_array_le(self) -> [u8; 8]

Source§

fn into_array_ne(self) -> [u8; 8]

Source§

impl PrimSplit<u8, 16> for u128

Source§

fn into_array_be(self) -> [u8; 16]

Source§

fn into_array_le(self) -> [u8; 16]

Source§

fn into_array_ne(self) -> [u8; 16]

Source§

impl PrimSplit<u16, 2> for u32

Source§

fn into_array_be(self) -> [u16; 2]

Source§

fn into_array_le(self) -> [u16; 2]

Source§

fn into_array_ne(self) -> [u16; 2]

Source§

impl PrimSplit<u16, 4> for u64

Source§

fn into_array_be(self) -> [u16; 4]

Source§

fn into_array_le(self) -> [u16; 4]

Source§

fn into_array_ne(self) -> [u16; 4]

Source§

impl PrimSplit<u16, 8> for u128

Source§

fn into_array_be(self) -> [u16; 8]

Source§

fn into_array_le(self) -> [u16; 8]

Source§

fn into_array_ne(self) -> [u16; 8]

Source§

impl PrimSplit<u32, 2> for u64

Source§

fn into_array_be(self) -> [u32; 2]

Source§

fn into_array_le(self) -> [u32; 2]

Source§

fn into_array_ne(self) -> [u32; 2]

Source§

impl PrimSplit<u32, 4> for u128

Source§

fn into_array_be(self) -> [u32; 4]

Source§

fn into_array_le(self) -> [u32; 4]

Source§

fn into_array_ne(self) -> [u32; 4]

Source§

impl PrimSplit<u64, 2> for u128

Source§

fn into_array_be(self) -> [u64; 2]

Source§

fn into_array_le(self) -> [u64; 2]

Source§

fn into_array_ne(self) -> [u64; 2]

Implementors§