Struct mycelium_bitfield::pack::Packing16
source · [−]pub struct Packing16(_);
Expand description
Wraps a u16
to add methods for packing bit ranges specified by Pack16
.
See the module-level documentation for details on using packing specs.
Implementations
sourceimpl Packing16
impl Packing16
sourcepub const fn pack_truncating(self, value: u16, packer: &Pack16) -> Self
pub const fn pack_truncating(self, value: u16, packer: &Pack16) -> 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<u16>>(self, value: T, packer: &Pack16<T>) -> Self
pub fn pack<T: FromBits<u16>>(self, value: T, packer: &Pack16<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: &Pack16) -> Self
pub const fn set_all(self, packer: &Pack16) -> Self
Set all bits in the range specified by packer
to 1 in self
.
sourcepub const fn unset_all(self, packer: &Pack16) -> Self
pub const fn unset_all(self, packer: &Pack16) -> Self
Set all bits in the range specified by packer
to 0 in
self
.
sourcepub const fn contains_any(self, packer: &Pack16) -> bool
pub const fn contains_any(self, packer: &Pack16) -> bool
Returns true
if any bits specified by packer
are set
in self
.
sourcepub const fn contains_all(self, packer: &Pack16) -> bool
pub const fn contains_all(self, packer: &Pack16) -> bool
Returns true
if any bits specified by packer
are set
in self
.
Trait Implementations
impl Copy for Packing16
impl Eq for Packing16
impl StructuralEq for Packing16
impl StructuralPartialEq for Packing16
Auto Trait Implementations
impl RefUnwindSafe for Packing16
impl Send for Packing16
impl Sync for Packing16
impl Unpin for Packing16
impl UnwindSafe for Packing16
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