Struct bitvec::index::BitSel [−][src]
#[repr(transparent)]pub struct BitSel<R = usize> where
R: BitRegister, { /* fields omitted */ }
Expand description
One-Hot Bit Selection Mask
This type selects exactly one bit in a register. It is a BitPos
shifted from
a counter to a selector, and is used to apply test and write operations to real
memory.
Type Parameters
R
: The register element this selector governs.
Validity
Values of this type are required to have exactly one bit set and all others cleared. Any other value makes the program incorrect, and will cause memory corruption.
Construction
This type is only constructed from BitPos
, and is always equivalent to
1 << BitPos
.
The chain of custody from known-good BitIdx
values, through proven-good
BitOrder
implementations, into BitPos
and then BitSel
proves that values
of this type are always correct to apply to real memory.
Implementations
Wraps a selector value as a known-good selection in an R
register.
Parameters
sel
: A one-hot selection mask of a bit in anR
register.
Returns
This returns Some(sel)
when it is a power of two (exactly one bit set
and all others cleared), and None
when it is not.
Wraps a selector value as an assumed-good selection in an R
register.
Parameters
sel
: A one-hot selection mask of a bit in anR
register.
Returns
This unconditionally marks sel
as a one-hot bit selector.
Safety
If the sel
value has zero or multiple bits set, then it is invalid to
be used as a BitSel
and the program is incorrect. Debug builds will
panic; release builds do not inspect the value or specify a behavior.
Removes the one-hot selection wrapper, leaving the internal mask.
pub fn range_all(
) -> impl Iterator<Item = Self> + DoubleEndedIterator + ExactSizeIterator + FusedIterator
pub fn range_all(
) -> impl Iterator<Item = Self> + DoubleEndedIterator + ExactSizeIterator + FusedIterator
Iterates over all possible selector values.
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 BitSel<R> where
R: RefUnwindSafe,
impl<R> UnwindSafe for BitSel<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