Struct mycelium_bitfield::pack::PackingUsize
source · [−]pub struct PackingUsize(_);
Expand description
Wraps a usize
to add methods for packing bit ranges specified by PackUsize
.
See the module-level documentation for details on using packing specs.
Implementations
sourceimpl PackingUsize
impl PackingUsize
sourcepub const fn pack_truncating(self, value: usize, packer: &PackUsize) -> Self
pub const fn pack_truncating(self, value: usize, packer: &PackUsize) -> 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 fn pack<T: FromBits<usize>>(self, value: T, packer: &PackUsize<T>) -> Self
pub fn pack<T: FromBits<usize>>(self, value: T, packer: &PackUsize<T>) -> 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(self, packer: &PackUsize) -> Self
pub const fn set_all(self, packer: &PackUsize) -> Self
Set all bits in the range specified by packer
to 1 in self
.
sourcepub const fn unset_all(self, packer: &PackUsize) -> Self
pub const fn unset_all(self, packer: &PackUsize) -> Self
Set all bits in the range specified by packer
to 0 in
self
.
sourcepub const fn contains_any(self, packer: &PackUsize) -> bool
pub const fn contains_any(self, packer: &PackUsize) -> bool
Returns true
if any bits specified by packer
are set
in self
.
sourcepub const fn contains_all(self, packer: &PackUsize) -> bool
pub const fn contains_all(self, packer: &PackUsize) -> bool
Returns true
if any bits specified by packer
are set
in self
.
Trait Implementations
sourceimpl Binary for PackingUsize
impl Binary for PackingUsize
sourceimpl Clone for PackingUsize
impl Clone for PackingUsize
sourcefn clone(&self) -> PackingUsize
fn clone(&self) -> PackingUsize
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for PackingUsize
impl Debug for PackingUsize
sourceimpl From<PackingUsize> for usize
impl From<PackingUsize> for usize
sourcefn from(packing: PackingUsize) -> Self
fn from(packing: PackingUsize) -> Self
Converts to this type from the input type.
sourceimpl From<usize> for PackingUsize
impl From<usize> for PackingUsize
sourceimpl LowerHex for PackingUsize
impl LowerHex for PackingUsize
sourceimpl PartialEq<PackingUsize> for PackingUsize
impl PartialEq<PackingUsize> for PackingUsize
sourcefn eq(&self, other: &PackingUsize) -> bool
fn eq(&self, other: &PackingUsize) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &PackingUsize) -> bool
fn ne(&self, other: &PackingUsize) -> bool
This method tests for !=
.
sourceimpl UpperHex for PackingUsize
impl UpperHex for PackingUsize
impl Copy for PackingUsize
impl Eq for PackingUsize
impl StructuralEq for PackingUsize
impl StructuralPartialEq for PackingUsize
Auto Trait Implementations
impl RefUnwindSafe for PackingUsize
impl Send for PackingUsize
impl Sync for PackingUsize
impl Unpin for PackingUsize
impl UnwindSafe for PackingUsize
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more