aligned_array

Trait AsNeSlice

Source
pub trait AsNeSlice {
    // Required methods
    fn as_ne_u16_slice(&self) -> &[u16];
    fn as_mut_ne_u16_slice(&mut self) -> &mut [u16];
    fn as_ne_u32_slice(&self) -> &[u32];
    fn as_mut_ne_u32_slice(&mut self) -> &mut [u32];
    fn as_ne_u64_slice(&self) -> &[u64];
    fn as_mut_ne_u64_slice(&mut self) -> &mut [u64];
}
Expand description

Trait for types which can be viewed as native-endian integer slices This should generally just be, aligned slices of dumb bytes or similar. (Indeed the only intended implementor is Aligned<A8, GenericArray<u8, N>>)

This should only be implemented when all the bytes in the underlying object can be accessed this way. So, the number of bytes should be divisible by 8 and aligned to an 8 byte boundary.

TODO: This could be 3 traits instead, one for each integer type, but we didn’t need that yet.

Required Methods§

Source

fn as_ne_u16_slice(&self) -> &[u16]

Represent the value as native-endian u16’s

Source

fn as_mut_ne_u16_slice(&mut self) -> &mut [u16]

Represent the value as mutable native-endian u16’s

Source

fn as_ne_u32_slice(&self) -> &[u32]

Represent the value as native-endian u32’s

Source

fn as_mut_ne_u32_slice(&mut self) -> &mut [u32]

Represent the value as mutable native-endian u32’s

Source

fn as_ne_u64_slice(&self) -> &[u64]

Represent the value as native-endian u64’s

Source

fn as_mut_ne_u64_slice(&mut self) -> &mut [u64]

Represent the value as mutable native-endian u64’s

Implementors§

Source§

impl<A, N> AsNeSlice for Aligned<A, GenericArray<u8, N>>
where A: Alignment, A::Num: IsGreaterOrEqual<U8, Output = B1>, N: ArrayLength<u8> + PartialDiv<U8>,