Struct bitmaps::Bitmap[][src]

pub struct Bitmap<const SIZE: usize> where
    BitsImpl<{ SIZE }>: Bits
{ /* fields omitted */ }

A compact array of bits.

The type used to store the bitmap will be the minimum unsigned integer type required to fit the number of bits, from u8 to u128. If the size is 1, bool is used. If the size exceeds 128, an array of u128 will be used, sized as appropriately. The maximum supported size is currently 1024, represented by an array [u128; 8].

Implementations

impl Bitmap<128>[src]

pub unsafe fn load_m128i(&self) -> __m128i[src]

This is supported with target feature sse2 only.

impl Bitmap<256>[src]

pub unsafe fn load_m128i(&self) -> [__m128i; 2][src]

This is supported with target feature sse2 only.

pub unsafe fn load_m256i(&self) -> __m256i[src]

This is supported with target feature avx only.

impl Bitmap<512>[src]

pub unsafe fn load_m128i(&self) -> [__m128i; 4][src]

This is supported with target feature sse2 only.

pub unsafe fn load_m256i(&self) -> [__m256i; 2][src]

This is supported with target feature avx only.

impl Bitmap<768>[src]

pub unsafe fn load_m128i(&self) -> [__m128i; 6][src]

This is supported with target feature sse2 only.

pub unsafe fn load_m256i(&self) -> [__m256i; 3][src]

This is supported with target feature avx only.

impl Bitmap<1024>[src]

pub unsafe fn load_m128i(&self) -> [__m128i; 8][src]

This is supported with target feature sse2 only.

pub unsafe fn load_m256i(&self) -> [__m256i; 4][src]

This is supported with target feature avx only.

impl<const SIZE: usize> Bitmap<{ SIZE }> where
    BitsImpl<SIZE>: Bits
[src]

pub fn new() -> Self[src]

Construct a bitmap with every bit set to false.

pub fn mask(bits: usize) -> Self[src]

Construct a bitmap where every bit with index less than bits is true, and every other bit is false.

pub fn from_value(data: <BitsImpl<SIZE> as Bits>::Store) -> Self[src]

Construct a bitmap from a value of the same type as its backing store.

pub fn into_value(self) -> <BitsImpl<SIZE> as Bits>::Store[src]

Convert this bitmap into a value of the type of its backing store.

pub fn as_value(&self) -> &<BitsImpl<SIZE> as Bits>::Store[src]

Get a reference to this bitmap’s backing store.

pub fn len(self) -> usize[src]

Count the number of true bits in the bitmap.

pub fn is_empty(self) -> bool[src]

Test if the bitmap contains only false bits.

pub fn is_full(self) -> bool[src]

Test if the bitmap contains only true bits.

pub fn get(self, index: usize) -> bool[src]

Get the value of the bit at a given index.

pub fn set(&mut self, index: usize, value: bool) -> bool[src]

Set the value of the bit at a given index.

Returns the previous value of the bit.

pub fn first_index(self) -> Option<usize>[src]

Find the index of the first true bit in the bitmap.

pub fn first_false_index(self) -> Option<usize>[src]

Find the index of the first false bit in the bitmap.

pub fn invert(&mut self)[src]

Invert all the bits in the bitmap.

Trait Implementations

impl<const SIZE: usize> BitAnd<Bitmap<SIZE>> for Bitmap<{ SIZE }> where
    BitsImpl<{ SIZE }>: Bits
[src]

type Output = Self

The resulting type after applying the & operator.

impl<const SIZE: usize> BitAndAssign<Bitmap<SIZE>> for Bitmap<{ SIZE }> where
    BitsImpl<{ SIZE }>: Bits
[src]

impl<const SIZE: usize> BitOr<Bitmap<SIZE>> for Bitmap<{ SIZE }> where
    BitsImpl<{ SIZE }>: Bits
[src]

type Output = Self

The resulting type after applying the | operator.

impl<const SIZE: usize> BitOrAssign<Bitmap<SIZE>> for Bitmap<{ SIZE }> where
    BitsImpl<{ SIZE }>: Bits
[src]

impl<const SIZE: usize> BitXor<Bitmap<SIZE>> for Bitmap<{ SIZE }> where
    BitsImpl<{ SIZE }>: Bits
[src]

type Output = Self

The resulting type after applying the ^ operator.

impl<const SIZE: usize> BitXorAssign<Bitmap<SIZE>> for Bitmap<{ SIZE }> where
    BitsImpl<{ SIZE }>: Bits
[src]

impl<const SIZE: usize> Clone for Bitmap<{ SIZE }> where
    BitsImpl<{ SIZE }>: Bits
[src]

impl<const SIZE: usize> Copy for Bitmap<{ SIZE }> where
    BitsImpl<{ SIZE }>: Bits
[src]

impl<const SIZE: usize> Debug for Bitmap<{ SIZE }> where
    BitsImpl<{ SIZE }>: Bits
[src]

impl<const SIZE: usize> Default for Bitmap<{ SIZE }> where
    BitsImpl<{ SIZE }>: Bits
[src]

impl<const SIZE: usize> Eq for Bitmap<{ SIZE }> where
    BitsImpl<{ SIZE }>: Bits
[src]

impl From<[u128; 2]> for Bitmap<256>[src]

impl From<[u128; 3]> for Bitmap<384>[src]

impl From<[u128; 4]> for Bitmap<512>[src]

impl From<[u128; 5]> for Bitmap<640>[src]

impl From<[u128; 6]> for Bitmap<768>[src]

impl From<[u128; 7]> for Bitmap<896>[src]

impl From<[u128; 8]> for Bitmap<1024>[src]

impl From<__m128i> for Bitmap<128>[src]

impl From<__m256i> for Bitmap<256>[src]

impl<const SIZE: usize> Hash for Bitmap<{ SIZE }> where
    BitsImpl<{ SIZE }>: Bits,
    <BitsImpl<{ SIZE }> as Bits>::Store: Hash
[src]

impl<'a, const SIZE: usize> IntoIterator for &'a Bitmap<{ SIZE }> where
    BitsImpl<{ SIZE }>: Bits
[src]

type Item = usize

The type of the elements being iterated over.

type IntoIter = Iter<'a, { SIZE }>

Which kind of iterator are we turning this into?

impl<const SIZE: usize> Not for Bitmap<{ SIZE }> where
    BitsImpl<{ SIZE }>: Bits
[src]

type Output = Self

The resulting type after applying the ! operator.

impl<const SIZE: usize> Ord for Bitmap<{ SIZE }> where
    BitsImpl<{ SIZE }>: Bits,
    <BitsImpl<{ SIZE }> as Bits>::Store: Ord
[src]

impl<const SIZE: usize> PartialEq<Bitmap<SIZE>> for Bitmap<{ SIZE }> where
    BitsImpl<{ SIZE }>: Bits
[src]

impl<const SIZE: usize> PartialOrd<Bitmap<SIZE>> for Bitmap<{ SIZE }> where
    BitsImpl<{ SIZE }>: Bits,
    <BitsImpl<{ SIZE }> as Bits>::Store: PartialOrd
[src]

Auto Trait Implementations

impl<const SIZE: usize> !RefUnwindSafe for Bitmap<SIZE>

impl<const SIZE: usize> !Send for Bitmap<SIZE>

impl<const SIZE: usize> !Sync for Bitmap<SIZE>

impl<const SIZE: usize> !Unpin for Bitmap<SIZE>

impl<const SIZE: usize> !UnwindSafe for Bitmap<SIZE>

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> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<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.