Struct hashbrown::raw::inner::bitmask::BitMask

source ·
pub(crate) struct BitMask(pub(crate) u16);
Expand description

A bit mask which contains the result of a Match operation on a Group and allows iterating through them.

The bit mask is arranged so that low-order bits represent lower memory addresses for group match results.

For implementation reasons, the bits in the set may be sparsely packed with groups of 8 bits representing one element. If any of these bits are non-zero then this element is considered to true in the mask. If this is the case, BITMASK_STRIDE will be 8 to indicate a divide-by-8 should be performed on counts/indices to normalize this difference. BITMASK_MASK is similarly a mask of all the actually-used bits.

To iterate over a bit mask, it must be converted to a form where only 1 bit is set per element. This is done by applying BITMASK_ITER_MASK on the mask bits.

Tuple Fields§

§0: u16

Implementations§

source§

impl BitMask

source

pub(crate) fn invert(self) -> Self

Returns a new BitMask with all bits inverted.

source

fn remove_lowest_bit(self) -> Self

Returns a new BitMask with the lowest bit removed.

source

pub(crate) fn any_bit_set(self) -> bool

Returns whether the BitMask has at least one set bit.

source

pub(crate) fn lowest_set_bit(self) -> Option<usize>

Returns the first set bit in the BitMask, if there is one.

source

pub(crate) fn trailing_zeros(self) -> usize

Returns the number of trailing zeroes in the BitMask.

source

fn nonzero_trailing_zeros(nonzero: NonZeroU16) -> usize

Same as above but takes a NonZeroBitMaskWord.

source

pub(crate) fn leading_zeros(self) -> usize

Returns the number of leading zeroes in the BitMask.

Trait Implementations§

source§

impl Clone for BitMask

source§

fn clone(&self) -> BitMask

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl IntoIterator for BitMask

§

type Item = usize

The type of the elements being iterated over.
§

type IntoIter = BitMaskIter

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> BitMaskIter

Creates an iterator from a value. Read more
source§

impl Copy for BitMask

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.