Struct mycelium_bitfield::pack::PairUsize
source · pub struct PairUsize<T = usize> { /* private fields */ }
Expand description
A pair of PackUsizes, allowing a bit range to be unpacked from one offset in a usize value, and packed into a different offset in a different value.
See the module-level documentation for details on using packing specs.
Implementations§
source§impl PairUsize
impl PairUsize
sourcepub const fn pack_from_src(&self, src: usize, dst: usize) -> usize
pub const fn pack_from_src(&self, src: usize, dst: usize) -> usize
Pack bits from the source location in src
into the
destination location in dst
.
sourcepub const fn pack_from_dst(&self, src: usize, dst: usize) -> usize
pub const fn pack_from_dst(&self, src: usize, dst: usize) -> usize
Pack bits from the destination location in dst
into the
source location in src
.
sourcepub fn assert_valid(&self)
pub fn assert_valid(&self)
Asserts that this packing pair is valid.
Because assertions cannot be made in const fn
, this
performs validating assertions that would ideally be made
when constructing a new instance of this type. When packing
specs are declared as const
s, this method can be called in
a unit test to ensure that the spec is valid.
Trait Implementations§
impl<T> Copy for PairUsize<T>
impl<T> Eq for PairUsize<T>
Auto Trait Implementations§
impl<T> Freeze for PairUsize<T>
impl<T> RefUnwindSafe for PairUsize<T>
impl<T> Send for PairUsize<T>
impl<T> Sync for PairUsize<T>
impl<T> Unpin for PairUsize<T>
impl<T> UnwindSafe for PairUsize<T>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)