Struct bitvec::indices::BitMask [−][src]
Wrapper type indicating a one-hot encoding of a bit mask for an element.
This type is produced by BitOrder
implementations to speed up access to the
underlying memory. It ensures that masks have exactly one set bit, and can
safely be used as a mask for read/write access to memory.
Type Parameters
T
: The storage type being masked.
Implementations
impl<T> BitMask<T> where
T: BitStore,
[src]
T: BitStore,
pub fn new(mask: T) -> Self
[src]
Produce a new bit-mask wrapper around a one-hot mask value.
BitOrder
implementations should prefer this method, but may use
::new_unchecked
if they can guarantee that the one-hot invariant is
upheld.
Parameters
mask
: The mask value to encode. This must have exactly one bit set high, and all others set low.
Returns
mask
wrapped in the BitMask
marker type.
Panics
This function unconditionally panics if mask
has zero or multiple bits
set high.
pub unsafe fn new_unchecked(mask: T) -> Self
[src]
Produce a new bit-mask wrapper around any value.
Safety
The caller must ensure that mask
has exactly one bit set. BitOrder
implementations should prefer ::new
, which always panics on failure.
Parameters
mask
: The mask value to encode. This must have exactly one bit set. Failure to uphold this requirement will introduce uncontrolled state contamination.
Returns
mask
wrapped in the BitMask
marker type.
Panics
This function panics if mask
has zero or multiple bits set, only in
debug builds. It does not inspect mask
in release builds.
Trait Implementations
impl<T: Clone> Clone for BitMask<T> where
T: BitStore,
[src]
T: BitStore,
impl<T: Copy> Copy for BitMask<T> where
T: BitStore,
[src]
T: BitStore,
impl<T: Debug> Debug for BitMask<T> where
T: BitStore,
[src]
T: BitStore,
impl<T: Default> Default for BitMask<T> where
T: BitStore,
[src]
T: BitStore,
impl<T> Deref for BitMask<T> where
T: BitStore,
[src]
T: BitStore,
impl<T: Eq> Eq for BitMask<T> where
T: BitStore,
[src]
T: BitStore,
impl<T: Hash> Hash for BitMask<T> where
T: BitStore,
[src]
T: BitStore,
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<T: Ord> Ord for BitMask<T> where
T: BitStore,
[src]
T: BitStore,
fn cmp(&self, other: &BitMask<T>) -> 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<T: PartialEq> PartialEq<BitMask<T>> for BitMask<T> where
T: BitStore,
[src]
T: BitStore,
impl<T: PartialOrd> PartialOrd<BitMask<T>> for BitMask<T> where
T: BitStore,
[src]
T: BitStore,
fn partial_cmp(&self, other: &BitMask<T>) -> 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<T> StructuralEq for BitMask<T> where
T: BitStore,
[src]
T: BitStore,
impl<T> StructuralPartialEq for BitMask<T> where
T: BitStore,
[src]
T: BitStore,
Auto Trait Implementations
impl<T> RefUnwindSafe for BitMask<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for BitMask<T>
impl<T> Sync for BitMask<T>
impl<T> Unpin for BitMask<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for BitMask<T> where
T: UnwindSafe,
T: 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> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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, 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>,