Struct bitvec::index::BitMask [−][src]
#[repr(transparent)]pub struct BitMask<R = usize> where
R: BitRegister, { /* fields omitted */ }
Expand description
Multi-Bit Selection Mask
Unlike BitSel
, which enforces a strict one-hot mask encoding, this type
permits any number of bits to be set or cleared. This is used to accumulate
selections for batched operations on a register in real memory.
Type Parameters
R
: The register element that this mask governs.
Construction
This must only be constructed by combining BitSel
selection masks produced
through the accepted chains of custody beginning with BitIdx
values.
Bit-masks not constructed in this manner are not guaranteed to be correct in the
caller’s context and may lead to incorrect memory behaviors.
Implementations
Wraps any R
value as a bit-mask.
This constructor is provided to explicitly declare that an operation is discarding the numeric value of an integer and instead using it only as a bit-mask.
Parameters
mask
: Some integer to use as a bit-mask.
Returns
The mask
value wrapped as a bit-mask, with its numeric context
discarded.
Prefer accumulating BitSel
values using its Sum
implementation.
Safety
The mask
value must be computed from a set of valid bit positions in
the caller’s context.
Removes the mask wrapper, leaving the internal value.
Tests if a mask contains a given selector bit.
Parameters
&self
: The mask being tested.sel
: A selector bit to test inself
.
Returns
Whether self
has set the bit that sel
indicates.
Inserts a selector bit into a mask.
Parameters
&mut self
: The mask being modified.sel
: A selector bit to insert intoself
.
Effects
The sel
bit is set in the mask.
Creates a new mask with a selector bit activated.
Parameters
self
: The original mask.sel
: The selector bit being added into the mask.
Returns
A new bit-mask with sel
activated.
Trait Implementations
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl<R> RefUnwindSafe for BitMask<R> where
R: RefUnwindSafe,
impl<R> UnwindSafe for BitMask<R> where
R: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
Causes self
to use its Binary
implementation when Debug
-formatted. Read more
Causes self
to use its Display
implementation when
Debug
-formatted. Read more
Causes self
to use its LowerExp
implementation when
Debug
-formatted. Read more
Causes self
to use its LowerHex
implementation when
Debug
-formatted. Read more
Causes self
to use its Octal
implementation when Debug
-formatted. Read more
Causes self
to use its Pointer
implementation when
Debug
-formatted. Read more
Causes self
to use its UpperExp
implementation when
Debug
-formatted. Read more
Causes self
to use its UpperHex
implementation when
Debug
-formatted. Read more
Pipes by value. This is generally the method you want to use. Read more
Borrows self
and passes that borrow into the pipe function. Read more
Mutably borrows self
and passes that borrow into the pipe function. Read more
Borrows self
, then passes self.borrow()
into the pipe function. Read more
Mutably borrows self
, then passes self.borrow_mut()
into the pipe
function. Read more
Borrows self
, then passes self.as_ref()
into the pipe function.
Mutably borrows self
, then passes self.as_mut()
into the pipe
function. Read more
Borrows self
, then passes self.deref()
into the pipe function.
Immutable access to the Borrow<B>
of a value. Read more
Mutable access to the BorrowMut<B>
of a value. Read more
Immutable access to the AsRef<R>
view of a value. Read more
Mutable access to the AsMut<R>
view of a value. Read more
Immutable access to the Deref::Target
of a value. Read more
Mutable access to the Deref::Target
of a value. Read more
Calls .tap()
only in debug builds, and is erased in release builds.
Calls .tap_mut()
only in debug builds, and is erased in release
builds. Read more
Calls .tap_borrow()
only in debug builds, and is erased in release
builds. Read more
Calls .tap_borrow_mut()
only in debug builds, and is erased in release
builds. Read more
Calls .tap_ref()
only in debug builds, and is erased in release
builds. Read more
Calls .tap_ref_mut()
only in debug builds, and is erased in release
builds. Read more
Calls .tap_deref()
only in debug builds, and is erased in release
builds. Read more