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§
source§impl<A, B> PartialEq<&PairUsize<B>> for PairUsize<A>
impl<A, B> PartialEq<&PairUsize<B>> for PairUsize<A>
source§impl<A, B> PartialEq<PairUsize<B>> for &PairUsize<A>
impl<A, B> PartialEq<PairUsize<B>> for &PairUsize<A>
source§impl<A, B> PartialEq<PairUsize<B>> for PairUsize<A>
impl<A, B> PartialEq<PairUsize<B>> for PairUsize<A>
impl<T> Copy for PairUsize<T>
impl<T> Eq for PairUsize<T>
Auto Trait Implementations§
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