Struct bitvec::index::BitMask [−][src]
A multi-bit selection mask for a register R
.
Unlike BitSel
, which enforces a strict one-hot mask encoding, this mask type
permits any number of bits to be set or unset. This is used to accumulate
selections for a batched operation on a register.
Type Parameters
R
: The register element that this masks.
Construction
This can only be constructed by combining BitSel
selection mask produced
through the BitIdx
and BitOrder
chain of custody.
Implementations
impl<R> BitMask<R> where
R: BitRegister,
[src]
R: BitRegister,
pub const ALL: Self
[src]
A full mask.
pub const ZERO: Self
[src]
An empty mask.
pub fn new(value: R) -> Self
[src]
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
value
: Some integer to use as a bit-mask.
Returns
The value
wrapped as a bit-mask, with its numeric context discarded.
Prefer accumulating BitSel
values using the Sum
implementation.
Safety
The value
must be computed from a set of valid bit positions in the
caller’s context.
pub fn into_inner(self) -> R
[src]
Removes the mask wrapper, leaving the internal value.
pub fn test(&self, sel: BitSel<R>) -> bool
[src]
Tests whether the mask contains a given selector bit.
Parameters
&self
sel
: Some single selection bit to test inself
.
Returns
Whether self
is set high at sel
.
pub fn insert(&mut self, sel: BitSel<R>)
[src]
Inserts a selector bit into an existing mask.
Parameters
&mut self
sel
: A selector bit to set inself
.
Effects
The bit at sel
is set high in self
.
pub fn combine(self, sel: BitSel<R>) -> Self
[src]
Creates a new mask with a selector bit activated.
Parameters
self
sel
: A selector bit to set inself
Returns
A copy of self
, with sel
set high.
Trait Implementations
impl<R> Binary for BitMask<R> where
R: BitRegister,
[src]
R: BitRegister,
impl<R> BitAnd<R> for BitMask<R> where
R: BitRegister,
[src]
R: BitRegister,
type Output = Self
The resulting type after applying the &
operator.
fn bitand(self, rhs: R) -> Self::Output
[src]
impl<R> BitOr<R> for BitMask<R> where
R: BitRegister,
[src]
R: BitRegister,
type Output = Self
The resulting type after applying the |
operator.
fn bitor(self, rhs: R) -> Self::Output
[src]
impl<R: Clone> Clone for BitMask<R> where
R: BitRegister,
[src]
R: BitRegister,
impl<R: Copy> Copy for BitMask<R> where
R: BitRegister,
[src]
R: BitRegister,
impl<R> Debug for BitMask<R> where
R: BitRegister,
[src]
R: BitRegister,
impl<R: Default> Default for BitMask<R> where
R: BitRegister,
[src]
R: BitRegister,
impl<R> Display for BitMask<R> where
R: BitRegister,
[src]
R: BitRegister,
impl<R: Eq> Eq for BitMask<R> where
R: BitRegister,
[src]
R: BitRegister,
impl<R: Hash> Hash for BitMask<R> where
R: BitRegister,
[src]
R: BitRegister,
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<R> Not for BitMask<R> where
R: BitRegister,
[src]
R: BitRegister,
type Output = Self
The resulting type after applying the !
operator.
fn not(self) -> Self::Output
[src]
impl<R: Ord> Ord for BitMask<R> where
R: BitRegister,
[src]
R: BitRegister,
fn cmp(&self, other: &BitMask<R>) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl<R: PartialEq> PartialEq<BitMask<R>> for BitMask<R> where
R: BitRegister,
[src]
R: BitRegister,
impl<R: PartialOrd> PartialOrd<BitMask<R>> for BitMask<R> where
R: BitRegister,
[src]
R: BitRegister,
fn partial_cmp(&self, other: &BitMask<R>) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<R> StructuralEq for BitMask<R> where
R: BitRegister,
[src]
R: BitRegister,
impl<R> StructuralPartialEq for BitMask<R> where
R: BitRegister,
[src]
R: BitRegister,
impl<R> Sum<BitSel<R>> for BitMask<R> where
R: BitRegister,
[src]
R: BitRegister,
Auto Trait Implementations
impl<R> RefUnwindSafe for BitMask<R> where
R: RefUnwindSafe,
R: RefUnwindSafe,
impl<R> Send for BitMask<R>
impl<R> Sync for BitMask<R>
impl<R> Unpin for BitMask<R>
impl<R> UnwindSafe for BitMask<R> where
R: UnwindSafe,
R: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Conv for T
[src]
impl<T> FmtForward for T
[src]
pub fn fmt_binary(self) -> FmtBinary<Self> where
Self: Binary,
[src]
Self: Binary,
pub fn fmt_display(self) -> FmtDisplay<Self> where
Self: Display,
[src]
Self: Display,
pub fn fmt_lower_exp(self) -> FmtLowerExp<Self> where
Self: LowerExp,
[src]
Self: LowerExp,
pub fn fmt_lower_hex(self) -> FmtLowerHex<Self> where
Self: LowerHex,
[src]
Self: LowerHex,
pub fn fmt_octal(self) -> FmtOctal<Self> where
Self: Octal,
[src]
Self: Octal,
pub fn fmt_pointer(self) -> FmtPointer<Self> where
Self: Pointer,
[src]
Self: Pointer,
pub fn fmt_upper_exp(self) -> FmtUpperExp<Self> where
Self: UpperExp,
[src]
Self: UpperExp,
pub fn fmt_upper_hex(self) -> FmtUpperHex<Self> where
Self: UpperHex,
[src]
Self: UpperHex,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pipe for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
[src]
pub fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R where
R: 'a,
[src]
R: 'a,
pub fn pipe_ref_mut<'a, R>(
&'a mut self,
func: impl FnOnce(&'a mut Self) -> R
) -> R where
R: 'a,
[src]
&'a mut self,
func: impl FnOnce(&'a mut Self) -> R
) -> R where
R: 'a,
pub fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R where
Self: Borrow<B>,
R: 'a,
B: 'a + ?Sized,
[src]
Self: Borrow<B>,
R: 'a,
B: 'a + ?Sized,
pub fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> R where
Self: BorrowMut<B>,
R: 'a,
B: 'a + ?Sized,
[src]
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> R where
Self: BorrowMut<B>,
R: 'a,
B: 'a + ?Sized,
pub fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R where
Self: AsRef<U>,
R: 'a,
U: 'a + ?Sized,
[src]
Self: AsRef<U>,
R: 'a,
U: 'a + ?Sized,
pub fn pipe_as_mut<'a, U, R>(
&'a mut self,
func: impl FnOnce(&'a mut U) -> R
) -> R where
Self: AsMut<U>,
R: 'a,
U: 'a + ?Sized,
[src]
&'a mut self,
func: impl FnOnce(&'a mut U) -> R
) -> R where
Self: AsMut<U>,
R: 'a,
U: 'a + ?Sized,
pub fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
Self: Deref<Target = T>,
T: 'a + ?Sized,
R: 'a,
[src]
Self: Deref<Target = T>,
T: 'a + ?Sized,
R: 'a,
pub fn pipe_deref_mut<'a, T, R>(
&'a mut self,
func: impl FnOnce(&'a mut T) -> R
) -> R where
Self: DerefMut<Target = T> + Deref,
T: 'a + ?Sized,
R: 'a,
[src]
&'a mut self,
func: impl FnOnce(&'a mut T) -> R
) -> R where
Self: DerefMut<Target = T> + Deref,
T: 'a + ?Sized,
R: 'a,
impl<T> Tap for T
[src]
pub fn tap(self, func: impl FnOnce(&Self)) -> Self
[src]
pub fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self
[src]
pub fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self where
Self: Borrow<B>,
B: ?Sized,
[src]
Self: Borrow<B>,
B: ?Sized,
pub fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self where
Self: BorrowMut<B>,
B: ?Sized,
[src]
Self: BorrowMut<B>,
B: ?Sized,
pub fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self where
Self: AsRef<R>,
R: ?Sized,
[src]
Self: AsRef<R>,
R: ?Sized,
pub fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self where
Self: AsMut<R>,
R: ?Sized,
[src]
Self: AsMut<R>,
R: ?Sized,
pub fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self where
Self: Deref<Target = T>,
T: ?Sized,
[src]
Self: Deref<Target = T>,
T: ?Sized,
pub fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self where
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
[src]
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
pub fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
[src]
pub fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
[src]
pub fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self where
Self: Borrow<B>,
B: ?Sized,
[src]
Self: Borrow<B>,
B: ?Sized,
pub fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self where
Self: BorrowMut<B>,
B: ?Sized,
[src]
Self: BorrowMut<B>,
B: ?Sized,
pub fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self where
Self: AsRef<R>,
R: ?Sized,
[src]
Self: AsRef<R>,
R: ?Sized,
pub fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self where
Self: AsMut<R>,
R: ?Sized,
[src]
Self: AsMut<R>,
R: ?Sized,
pub fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self where
Self: Deref<Target = T>,
T: ?Sized,
[src]
Self: Deref<Target = T>,
T: ?Sized,
pub fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self where
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
[src]
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T> TryConv for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,