pub struct BitSet<Conf: Config> { /* private fields */ }
Expand description

Hierarchical sparse bitset.

Tri-level hierarchy. Highest uint it can hold is Level0Mask::BITS * Level1Mask::BITS * DenseBlock::BITS.

Only last level contains blocks of actual data. Empty(skipped) data blocks are not allocated.

Structure optimized for intersection speed. (Other inter-bitset operations are in fact fast too - but intersection has lowest algorithmic complexity.) Insert/remove/contains is fast O(1) too.

Implementations§

source§

impl<Conf: Config> BitSet<Conf>

source

pub fn new() -> Self

source

pub fn insert(&mut self, index: usize)

Safety

Will panic, if index is out of range.

source

pub fn remove(&mut self, index: usize) -> bool

Returns false if index is invalid/not in bitset.

source

pub unsafe fn remove_unchecked(&mut self, index: usize)

Safety

index MUST exists in HiSparseBitset!

Trait Implementations§

source§

impl<'a, Conf, Rhs> BitAnd<Rhs> for &'a BitSet<Conf>
where Conf: Config,

source§

fn bitand(self, rhs: Rhs) -> Self::Output

Returns intersection of self and rhs bitsets.

§

type Output = BitSetOp<BitAndOp, &'a BitSet<Conf>, Rhs>

The resulting type after applying the & operator.
source§

impl<'a, Conf, Rhs> BitOr<Rhs> for &'a BitSet<Conf>
where Conf: Config,

source§

fn bitor(self, rhs: Rhs) -> Self::Output

Returns union of self and rhs bitsets.

§

type Output = BitSetOp<BitOrOp, &'a BitSet<Conf>, Rhs>

The resulting type after applying the | operator.
source§

impl<Conf: Config> BitSetBase for BitSet<Conf>

§

type Conf = Conf

source§

impl<'a, Conf, Rhs> BitXor<Rhs> for &'a BitSet<Conf>
where Conf: Config,

source§

fn bitxor(self, rhs: Rhs) -> Self::Output

Returns symmetric difference of self and rhs bitsets.

§

type Output = BitSetOp<BitXorOp, &'a BitSet<Conf>, Rhs>

The resulting type after applying the ^ operator.
source§

impl<Conf: Config> Clone for BitSet<Conf>

source§

fn clone(&self) -> Self

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<Conf: Config> Default for BitSet<Conf>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<Conf: Config, const N: usize> From<[usize; N]> for BitSet<Conf>

source§

fn from(value: [usize; N]) -> Self

Converts to this type from the input type.
source§

impl<Conf: Config> FromIterator<usize> for BitSet<Conf>

source§

fn from_iter<T: IntoIterator<Item = usize>>(iter: T) -> Self

Creates a value from an iterator. Read more
source§

impl<'a, Conf> IntoIterator for &'a BitSet<Conf>
where Conf: Config,

§

type Item = usize

The type of the elements being iterated over.
§

type IntoIter = <<&'a BitSet<Conf> as BitSetInterface>::IntoBlockIter as BlockIterator>::IndexIter

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

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl<Conf> IntoIterator for BitSet<Conf>
where Conf: Config,

§

type Item = usize

The type of the elements being iterated over.
§

type IntoIter = <<BitSet<Conf> as BitSetInterface>::IntoBlockIter as BlockIterator>::IndexIter

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

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl<'a, Conf, Rhs> Sub<Rhs> for &'a BitSet<Conf>
where Conf: Config,

source§

fn sub(self, rhs: Rhs) -> Self::Output

Returns difference of self and rhs bitsets.

Or relative complement of rhs in self.

§

type Output = BitSetOp<BitSubOp, &'a BitSet<Conf>, Rhs>

The resulting type after applying the - operator.

Auto Trait Implementations§

§

impl<Conf> RefUnwindSafe for BitSet<Conf>

§

impl<Conf> Send for BitSet<Conf>

§

impl<Conf> Sync for BitSet<Conf>

§

impl<Conf> Unpin for BitSet<Conf>

§

impl<Conf> UnwindSafe for BitSet<Conf>

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> BitSetInterface for T
where T: LevelMasksExt + IntoIterator<Item = usize>,

§

type BlockIter<'a> = CachingBlockIter<&'a T> where T: 'a

source§

fn block_iter(&self) -> <T as BitSetInterface>::BlockIter<'_>

§

type Iter<'a> = <<T as BitSetInterface>::BlockIter<'a> as BlockIterator>::IndexIter where T: 'a

source§

fn iter(&self) -> <T as BitSetInterface>::Iter<'_>

§

type IntoBlockIter = CachingBlockIter<T>

source§

fn into_block_iter(self) -> <T as BitSetInterface>::IntoBlockIter

source§

fn contains(&self, index: usize) -> bool

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.