Struct bitvec::index::BitMask[][src]

#[repr(transparent)]
pub struct BitMask<R> where
    R: BitRegister
{ /* fields omitted */ }

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]

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 in self.

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 in self.

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 in self

Returns

A copy of self, with sel set high.

Trait Implementations

impl<R> Binary for BitMask<R> where
    R: BitRegister
[src]

impl<R> BitAnd<R> for BitMask<R> where
    R: BitRegister
[src]

type Output = Self

The resulting type after applying the & operator.

impl<R> BitOr<R> for BitMask<R> where
    R: BitRegister
[src]

type Output = Self

The resulting type after applying the | operator.

impl<R: Clone> Clone for BitMask<R> where
    R: BitRegister
[src]

impl<R: Copy> Copy for BitMask<R> where
    R: BitRegister
[src]

impl<R> Debug for BitMask<R> where
    R: BitRegister
[src]

impl<R: Default> Default for BitMask<R> where
    R: BitRegister
[src]

impl<R> Display for BitMask<R> where
    R: BitRegister
[src]

impl<R: Eq> Eq for BitMask<R> where
    R: BitRegister
[src]

impl<R: Hash> Hash for BitMask<R> where
    R: BitRegister
[src]

impl<R> Not for BitMask<R> where
    R: BitRegister
[src]

type Output = Self

The resulting type after applying the ! operator.

impl<R: Ord> Ord for BitMask<R> where
    R: BitRegister
[src]

impl<R: PartialEq> PartialEq<BitMask<R>> for BitMask<R> where
    R: BitRegister
[src]

impl<R: PartialOrd> PartialOrd<BitMask<R>> for BitMask<R> where
    R: BitRegister
[src]

impl<R> StructuralEq for BitMask<R> where
    R: BitRegister
[src]

impl<R> StructuralPartialEq for BitMask<R> where
    R: BitRegister
[src]

impl<R> Sum<BitSel<R>> for BitMask<R> where
    R: BitRegister
[src]

Auto Trait Implementations

impl<R> RefUnwindSafe for BitMask<R> where
    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

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T[src]

impl<T> FmtForward for T[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pipe for T where
    T: ?Sized
[src]

impl<T> Tap for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> TryConv for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.