pub trait UnderlierType:
Debug
+ Default
+ Eq
+ Ord
+ Copy
+ Random
+ NoUninit
+ Zeroable
+ Sized
+ Send
+ Sync
+ 'static
+ BitAnd<Self, Output = Self>
+ BitAndAssign<Self>
+ BitOr<Self, Output = Self>
+ BitOrAssign<Self>
+ BitXor<Self, Output = Self>
+ BitXorAssign<Self>
+ Shr<usize, Output = Self>
+ Shl<usize, Output = Self>
+ Not<Output = Self>
+ Divisible<SmallU<1>> {
const LOG_BITS: usize;
const ZERO: Self;
const ONE: Self;
const ONES: Self;
const BITS: usize = _;
// Required method
fn interleave(self, other: Self, log_block_len: usize) -> (Self, Self);
// Provided methods
fn fill_with_bit(val: u8) -> Self { ... }
fn transpose(self, other: Self, log_block_len: usize) -> (Self, Self) { ... }
fn from_fn<T>(f: impl FnMut(usize) -> T) -> Self
where T: UnderlierType,
Self: Divisible<T> { ... }
fn broadcast_subvalue<T>(value: T) -> Self
where T: UnderlierType,
Self: Divisible<T> { ... }
unsafe fn get_subvalue<T>(&self, i: usize) -> T
where T: UnderlierType,
Self: Divisible<T> { ... }
unsafe fn set_subvalue<T>(&mut self, i: usize, val: T)
where T: UnderlierType,
Self: Divisible<T> { ... }
unsafe fn spread<T>(self, log_block_len: usize, block_idx: usize) -> Self
where T: UnderlierType,
Self: Divisible<T> { ... }
}Expand description
Primitive integer underlying a binary field or packed binary field implementation. Note that this type is not guaranteed to be POD, U1, U2 and U4 have some unused bits.
Required Associated Constants§
Provided Associated Constants§
Required Methods§
Sourcefn interleave(self, other: Self, log_block_len: usize) -> (Self, Self)
fn interleave(self, other: Self, log_block_len: usize) -> (Self, Self)
Interleave with the given bit size
Provided Methods§
Sourcefn fill_with_bit(val: u8) -> Self
fn fill_with_bit(val: u8) -> Self
Fill value with the given bit
val must be 0 or 1.
Sourcefn transpose(self, other: Self, log_block_len: usize) -> (Self, Self)
fn transpose(self, other: Self, log_block_len: usize) -> (Self, Self)
Transpose with the given bit size
fn from_fn<T>(f: impl FnMut(usize) -> T) -> Selfwhere
T: UnderlierType,
Self: Divisible<T>,
Sourcefn broadcast_subvalue<T>(value: T) -> Selfwhere
T: UnderlierType,
Self: Divisible<T>,
fn broadcast_subvalue<T>(value: T) -> Selfwhere
T: UnderlierType,
Self: Divisible<T>,
Broadcast subvalue to fill Self.
Self::BITS/T::BITS is supposed to be a power of 2.
Sourceunsafe fn get_subvalue<T>(&self, i: usize) -> Twhere
T: UnderlierType,
Self: Divisible<T>,
unsafe fn get_subvalue<T>(&self, i: usize) -> Twhere
T: UnderlierType,
Self: Divisible<T>,
Gets the subvalue from the given position. Function panics in case when index is out of range.
§Safety
i must be less than Self::BITS/T::BITS.
Sourceunsafe fn set_subvalue<T>(&mut self, i: usize, val: T)where
T: UnderlierType,
Self: Divisible<T>,
unsafe fn set_subvalue<T>(&mut self, i: usize, val: T)where
T: UnderlierType,
Self: Divisible<T>,
Sets the subvalue in the given position. Function panics in case when index is out of range.
§Safety
i must be less than Self::BITS/T::BITS.
Sourceunsafe fn spread<T>(self, log_block_len: usize, block_idx: usize) -> Selfwhere
T: UnderlierType,
Self: Divisible<T>,
unsafe fn spread<T>(self, log_block_len: usize, block_idx: usize) -> Selfwhere
T: UnderlierType,
Self: Divisible<T>,
Spread takes a block of sub_elements of T type within the current value and
repeats them to the full underlier width.
§Safety
log_block_len + T::LOG_BITS must be less than or equal to Self::LOG_BITS.
block_idx must be less than 1 << (Self::LOG_BITS - log_block_len).
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.