Trait DivisIterable

Source
pub trait DivisIterable<T> {
    type Iter<'a>: ExactSizeIterator<Item = &'a T>
       where Self: 'a,
             T: 'a;

    // Required method
    fn divide(&self) -> Self::Iter<'_>;
}
Expand description

Divides an underlier type into smaller underliers in memory and iterates over them.

DivisIterable (say that 10 times, fast) provides iteration over the subdivisions of an underlier type, guaranteeing that iteration proceeds from the least significant bits to the most significant bits, regardless of the CPU architecture’s endianness.

§Endianness Handling

To ensure consistent LSB-to-MSB iteration order across all platforms:

  • On little-endian systems: elements are naturally ordered LSB-to-MSB in memory, so iteration proceeds forward through the array
  • On big-endian systems: elements are ordered MSB-to-LSB in memory, so iteration is reversed to achieve LSB-to-MSB order

This abstraction allows code to work with subdivided underliers in a platform-independent way while maintaining the invariant that the first element always represents the least significant portion of the value.

Required Associated Types§

Source

type Iter<'a>: ExactSizeIterator<Item = &'a T> where Self: 'a, T: 'a

Required Methods§

Source

fn divide(&self) -> Self::Iter<'_>

Returns an iterator over subdivisions of this underlier, ordered from LSB to MSB.

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 DivisIterable<u8> for u16

Source§

type Iter<'a> = Iter<'a, u8>

Source§

fn divide(&self) -> Self::Iter<'_>

Source§

impl DivisIterable<u8> for u32

Source§

type Iter<'a> = Iter<'a, u8>

Source§

fn divide(&self) -> Self::Iter<'_>

Source§

impl DivisIterable<u8> for u64

Source§

type Iter<'a> = Iter<'a, u8>

Source§

fn divide(&self) -> Self::Iter<'_>

Source§

impl DivisIterable<u8> for u128

Source§

type Iter<'a> = Iter<'a, u8>

Source§

fn divide(&self) -> Self::Iter<'_>

Source§

impl DivisIterable<u16> for u32

Source§

type Iter<'a> = Iter<'a, u16>

Source§

fn divide(&self) -> Self::Iter<'_>

Source§

impl DivisIterable<u16> for u64

Source§

type Iter<'a> = Iter<'a, u16>

Source§

fn divide(&self) -> Self::Iter<'_>

Source§

impl DivisIterable<u16> for u128

Source§

type Iter<'a> = Iter<'a, u16>

Source§

fn divide(&self) -> Self::Iter<'_>

Source§

impl DivisIterable<u32> for u64

Source§

type Iter<'a> = Iter<'a, u32>

Source§

fn divide(&self) -> Self::Iter<'_>

Source§

impl DivisIterable<u32> for u128

Source§

type Iter<'a> = Iter<'a, u32>

Source§

fn divide(&self) -> Self::Iter<'_>

Source§

impl DivisIterable<u64> for u128

Source§

type Iter<'a> = Iter<'a, u64>

Source§

fn divide(&self) -> Self::Iter<'_>

Implementors§