pub trait UnderlierWithBitOps:
UnderlierType
+ 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> {
const ZERO: Self;
const ONE: Self;
const ONES: Self;
// Required method
fn fill_with_bit(val: u8) -> Self;
// Provided methods
fn from_fn<T>(f: impl FnMut(usize) -> T) -> Self
where T: UnderlierType,
Self: From<T> { ... }
fn broadcast_subvalue<T>(value: T) -> Self
where T: UnderlierType,
Self: From<T> { ... }
unsafe fn get_subvalue<T>(&self, i: usize) -> T
where T: UnderlierType + NumCast<Self> { ... }
unsafe fn set_subvalue<T>(&mut self, i: usize, val: T)
where T: UnderlierWithBitOps,
Self: From<T> { ... }
}
Expand description
Underlier type that supports bit arithmetic.
Required Associated Constants§
Required 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.
Provided Methods§
fn from_fn<T>(f: impl FnMut(usize) -> T) -> Selfwhere
T: UnderlierType,
Self: From<T>,
sourcefn broadcast_subvalue<T>(value: T) -> Selfwhere
T: UnderlierType,
Self: From<T>,
fn broadcast_subvalue<T>(value: T) -> Selfwhere
T: UnderlierType,
Self: From<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 + NumCast<Self>,
unsafe fn get_subvalue<T>(&self, i: usize) -> Twhere
T: UnderlierType + NumCast<Self>,
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: UnderlierWithBitOps,
Self: From<T>,
unsafe fn set_subvalue<T>(&mut self, i: usize, val: T)where
T: UnderlierWithBitOps,
Self: From<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
.
Object Safety§
This trait is not object safe.