Struct rustc_index::bit_set::SparseBitSet
source · 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
)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.