pub unsafe trait Divisible<Narrow: Underlier>: Underlier {
const RATIO: usize = _;
const CHECK_LAYOUT: () = _;
// Provided methods
fn parts(&self) -> &[Narrow] { ... }
fn parts_mut(&mut self) -> &mut [Narrow] { ... }
fn split_slice(slice: &[Self]) -> &[Narrow] { ... }
fn split_slice_mut(slice: &mut [Self]) -> &mut [Narrow] { ... }
}Expand description
A block that is exactly several narrower blocks laid end to end, part 0 lowest.
§Safety
The trait is sealed, and every implementation is checked below at compile time:
- the wide size is the ratio times the narrow size,
- the wide alignment is at least the narrow alignment,
- the target is little-endian whenever the narrow word is the shorter one.
The three together are what make the reinterpretations sound.
Provided Associated Constants§
Sourceconst CHECK_LAYOUT: () = _
const CHECK_LAYOUT: () = _
What every reinterpretation above rests on, rejected at compile time if it fails.
Reading a block at a narrower word is a memory-order view. A lane is defined on word values, so the two agree only on a little-endian target.
Views that keep the word width are pure reindexing, and hold either way.
Provided Methods§
Sourcefn parts_mut(&mut self) -> &mut [Narrow]
fn parts_mut(&mut self) -> &mut [Narrow]
The narrow blocks this one is made of, lowest bits first.
Sourcefn split_slice(slice: &[Self]) -> &[Narrow]
fn split_slice(slice: &[Self]) -> &[Narrow]
A run of wide blocks read as one run of narrow ones, lowest bits first.
Sourcefn split_slice_mut(slice: &mut [Self]) -> &mut [Narrow]
fn split_slice_mut(slice: &mut [Self]) -> &mut [Narrow]
A run of wide blocks read as one run of narrow ones, lowest bits first.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".