Struct mycelium_bitfield::pack::Packing128
source · pub struct Packing128(/* private fields */);
Expand description
Wraps a u128
to add methods for packing bit ranges specified by Pack128
.
See the module-level documentation for details on using packing specs.
Implementations§
source§impl Packing128
impl Packing128
sourcepub const fn pack_truncating(self, value: u128, packer: &Pack128) -> Self
pub const fn pack_truncating(self, value: u128, packer: &Pack128) -> Self
Pack bits from value
into self
, using the range
specified by packer
.
Any bits in value
outside the range specified by packer
are ignored.
sourcepub const fn pack_from_src(self, value: u128, pair: &Pair128) -> Self
pub const fn pack_from_src(self, value: u128, pair: &Pair128) -> Self
Pack bits from src
into self
, using the packing pair
specified by pair
, with self
serving as the “destination” member
of the pair, and src
serving as the “source” member of the
pair.
sourcepub const fn pack_from_dst(self, value: u128, pair: &Pair128) -> Self
pub const fn pack_from_dst(self, value: u128, pair: &Pair128) -> Self
Pack bits from dst
into self
, using the packing pair
specified by pair
, with self
serving as the “siyrce” member
of the pair, and dst
serving as the “destination” member of the
pair.
sourcepub fn pack<T: FromBits<u128>, F>(
self,
value: T,
packer: &Pack128<T, F>,
) -> Self
pub fn pack<T: FromBits<u128>, F>( self, value: T, packer: &Pack128<T, F>, ) -> Self
Pack bits from value
into self
, using the range
specified by packer
.
§Panics
If value
contains bits outside the range specified by packer
.
sourcepub const fn set_all<T, F>(self, packer: &Pack128<T, F>) -> Self
pub const fn set_all<T, F>(self, packer: &Pack128<T, F>) -> Self
Set all bits in the range specified by packer
to 1 in self
.
sourcepub const fn unset_all<T, F>(self, packer: &Pack128<T, F>) -> Self
pub const fn unset_all<T, F>(self, packer: &Pack128<T, F>) -> Self
Set all bits in the range specified by packer
to 0 in
self
.
sourcepub const fn contains_any<T, F>(self, packer: &Pack128<T, F>) -> bool
pub const fn contains_any<T, F>(self, packer: &Pack128<T, F>) -> bool
Returns true
if any bits specified by packer
are set
in self
.
sourcepub const fn contains_all<T, F>(self, packer: &Pack128<T, F>) -> bool
pub const fn contains_all<T, F>(self, packer: &Pack128<T, F>) -> bool
Returns true
if any bits specified by packer
are set
in self
.
Trait Implementations§
source§impl Binary for Packing128
impl Binary for Packing128
source§impl Clone for Packing128
impl Clone for Packing128
source§fn clone(&self) -> Packing128
fn clone(&self) -> Packing128
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for Packing128
impl Debug for Packing128
source§impl From<Packing128> for u128
impl From<Packing128> for u128
source§fn from(packing: Packing128) -> Self
fn from(packing: Packing128) -> Self
source§impl From<u128> for Packing128
impl From<u128> for Packing128
source§impl LowerHex for Packing128
impl LowerHex for Packing128
source§impl PartialEq for Packing128
impl PartialEq for Packing128
source§impl UpperHex for Packing128
impl UpperHex for Packing128
impl Copy for Packing128
impl Eq for Packing128
impl StructuralPartialEq for Packing128
Auto Trait Implementations§
impl Freeze for Packing128
impl RefUnwindSafe for Packing128
impl Send for Packing128
impl Sync for Packing128
impl Unpin for Packing128
impl UnwindSafe for Packing128
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
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)
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)
clone_to_uninit
)