Enum rustc_data_structures::indexed_set::HybridIdxSet [−][src]
pub enum HybridIdxSet<T: Idx> { Sparse(SparseIdxSet<T>, usize), Dense(IdxSet<T>, usize), }
Like IdxSet, but with a hybrid representation: sparse when there are few
elements in the set, but dense when there are many. It's especially
efficient for sets that typically have a small number of elements, but a
large domain_size
, and are cleared frequently.
Variants
Sparse(SparseIdxSet<T>, usize)
Dense(IdxSet<T>, usize)
Methods
impl<T: Idx> HybridIdxSet<T>
[src]
impl<T: Idx> HybridIdxSet<T>
pub fn new_empty(domain_size: usize) -> Self
[src]
pub fn new_empty(domain_size: usize) -> Self
pub fn clear(&mut self)
[src]
pub fn clear(&mut self)
pub fn contains(&self, elem: &T) -> bool
[src]
pub fn contains(&self, elem: &T) -> bool
Returns true iff set self
contains elem
.
pub fn add(&mut self, elem: &T) -> bool
[src]
pub fn add(&mut self, elem: &T) -> bool
Adds elem
to the set self
.
pub fn remove(&mut self, elem: &T) -> bool
[src]
pub fn remove(&mut self, elem: &T) -> bool
Removes elem
from the set self
.
pub fn to_dense(self) -> IdxSet<T>
[src]
pub fn to_dense(self) -> IdxSet<T>
Converts to a dense set, consuming itself in the process.
ⓘImportant traits for HybridIter<'a, T>pub fn iter(&self) -> HybridIter<T>
[src]
ⓘImportant traits for HybridIter<'a, T>
pub fn iter(&self) -> HybridIter<T>
Iteration order is unspecified.
Trait Implementations
impl<T: Clone + Idx> Clone for HybridIdxSet<T>
[src]
impl<T: Clone + Idx> Clone for HybridIdxSet<T>
fn clone(&self) -> HybridIdxSet<T>
[src]
fn clone(&self) -> HybridIdxSet<T>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0
[src]Performs copy-assignment from source
. Read more
impl<T: Debug + Idx> Debug for HybridIdxSet<T>
[src]
impl<T: Debug + Idx> Debug for HybridIdxSet<T>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<T: Idx> UnionIntoIdxSet<T> for HybridIdxSet<T>
[src]
impl<T: Idx> UnionIntoIdxSet<T> for HybridIdxSet<T>
fn union_into(&self, other: &mut IdxSet<T>) -> bool
[src]
fn union_into(&self, other: &mut IdxSet<T>) -> bool
impl<T: Idx> SubtractFromIdxSet<T> for HybridIdxSet<T>
[src]
impl<T: Idx> SubtractFromIdxSet<T> for HybridIdxSet<T>
fn subtract_from(&self, other: &mut IdxSet<T>) -> bool
[src]
fn subtract_from(&self, other: &mut IdxSet<T>) -> bool
Auto Trait Implementations
impl<T> Send for HybridIdxSet<T> where
T: Send,
impl<T> Send for HybridIdxSet<T> where
T: Send,
impl<T> Sync for HybridIdxSet<T> where
T: Sync,
impl<T> Sync for HybridIdxSet<T> where
T: Sync,