[][src]Struct bitvec::indices::BitMask

pub struct BitMask<T> where
    T: BitStore
{ /* fields omitted */ }

Wrapper type indicating a one-hot encoding of a bit mask for an element.

This type is produced by Cursor 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.

Methods

impl<T> BitMask<T> where
    T: BitStore
[src]

pub fn new(mask: T) -> Self[src]

Produce a new bit-mask wrapper around a one-hot mask value.

Cursor 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. Cursor 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]

impl<T: Copy> Copy for BitMask<T> where
    T: BitStore
[src]

impl<T: Default> Default for BitMask<T> where
    T: BitStore
[src]

impl<T: Eq> Eq for BitMask<T> where
    T: BitStore
[src]

impl<T: Ord> Ord for BitMask<T> where
    T: BitStore
[src]

impl<T: PartialEq> PartialEq<BitMask<T>> for BitMask<T> where
    T: BitStore
[src]

impl<T: PartialOrd> PartialOrd<BitMask<T>> for BitMask<T> where
    T: BitStore
[src]

impl<T: Debug> Debug for BitMask<T> where
    T: BitStore
[src]

impl<T> Deref for BitMask<T> where
    T: BitStore
[src]

type Target = T

The resulting type after dereferencing.

impl<T: Hash> Hash for BitMask<T> where
    T: BitStore
[src]

impl<T> StructuralPartialEq for BitMask<T> where
    T: BitStore
[src]

impl<T> StructuralEq for BitMask<T> where
    T: BitStore
[src]

Auto Trait Implementations

impl<T> Send for BitMask<T>

impl<T> Sync for BitMask<T>

impl<T> Unpin for BitMask<T> where
    T: Unpin

impl<T> UnwindSafe for BitMask<T> where
    T: UnwindSafe

impl<T> RefUnwindSafe for BitMask<T> where
    T: RefUnwindSafe

Blanket Implementations

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

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

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

type Owned = T

The resulting type after obtaining ownership.

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.

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

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

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