pub struct SparseBitSet<T> {
domain_size: usize,
elems: ArrayVec<T, SPARSE_MAX>,
}
Expand description
A fixed-size bitset type with a sparse representation and a maximum of
SPARSE_MAX
elements. The elements are stored as a sorted ArrayVec
with
no duplicates.
This type is used by HybridBitSet
; do not use directly.
Fields§
§domain_size: usize
§elems: ArrayVec<T, SPARSE_MAX>
Implementations§
Source§impl<T: Idx> SparseBitSet<T>
impl<T: Idx> SparseBitSet<T>
fn new_empty(domain_size: usize) -> Self
fn len(&self) -> usize
fn is_empty(&self) -> bool
fn contains(&self, elem: T) -> bool
fn insert(&mut self, elem: T) -> bool
fn remove(&mut self, elem: T) -> bool
fn to_dense(&self) -> BitSet<T>
fn iter(&self) -> Iter<'_, T>
Sourcepub fn union<Rhs>(&mut self, other: &Rhs) -> boolwhere
Self: BitRelations<Rhs>,
pub fn union<Rhs>(&mut self, other: &Rhs) -> boolwhere
Self: BitRelations<Rhs>,
Sets self = self | other
and returns true
if self
changed
(i.e., if new bits were added).
Sourcepub fn subtract<Rhs>(&mut self, other: &Rhs) -> boolwhere
Self: BitRelations<Rhs>,
pub fn subtract<Rhs>(&mut self, other: &Rhs) -> boolwhere
Self: BitRelations<Rhs>,
Sets self = self - other
and returns true
if self
changed.
(i.e., if any bits were removed).
Sourcepub fn intersect<Rhs>(&mut self, other: &Rhs) -> boolwhere
Self: BitRelations<Rhs>,
pub fn intersect<Rhs>(&mut self, other: &Rhs) -> boolwhere
Self: BitRelations<Rhs>,
Sets self = self & other
and return true
if self
changed.
(i.e., if any bits were removed).
Source§impl<T: Idx + Ord> SparseBitSet<T>
impl<T: Idx + Ord> SparseBitSet<T>
pub fn last_set_in(&self, range: impl RangeBounds<T>) -> Option<T>
Trait Implementations§
Source§impl<T: Clone> Clone for SparseBitSet<T>
impl<T: Clone> Clone for SparseBitSet<T>
Source§fn clone(&self) -> SparseBitSet<T>
fn clone(&self) -> SparseBitSet<T>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl<T> Freeze for SparseBitSet<T>where
T: Freeze,
impl<T> RefUnwindSafe for SparseBitSet<T>where
T: RefUnwindSafe,
impl<T> Send for SparseBitSet<T>where
T: Send,
impl<T> Sync for SparseBitSet<T>where
T: Sync,
impl<T> Unpin for SparseBitSet<T>where
T: Unpin,
impl<T> UnwindSafe for SparseBitSet<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Layout§
Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.