Struct rustc_data_structures::sso::SsoHashSet
source · [−]pub struct SsoHashSet<T> {
map: SsoHashMap<T, ()>,
}Expand description
Small-storage-optimized implementation of a set.
Stores elements in a small array up to a certain length
and switches to HashSet when that length is exceeded.
Fields
map: SsoHashMap<T, ()>Implementations
sourceimpl<T> SsoHashSet<T>
impl<T> SsoHashSet<T>
sourcepub fn with_capacity(cap: usize) -> Self
pub fn with_capacity(cap: usize) -> Self
Creates an empty SsoHashSet with the specified capacity.
sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
Returns the number of elements the set can hold without reallocating.
sourceimpl<T: Eq + Hash> SsoHashSet<T>
impl<T: Eq + Hash> SsoHashSet<T>
sourcepub fn reserve(&mut self, additional: usize)
pub fn reserve(&mut self, additional: usize)
Reserves capacity for at least additional more elements to be inserted
in the SsoHashSet. The collection may reserve more space to avoid
frequent reallocations.
sourcepub fn shrink_to_fit(&mut self)
pub fn shrink_to_fit(&mut self)
Shrinks the capacity of the set as much as possible. It will drop down as much as possible while maintaining the internal rules and possibly leaving some space in accordance with the resize policy.
sourcepub fn retain<F>(&mut self, f: F) where
F: FnMut(&T) -> bool,
pub fn retain<F>(&mut self, f: F) where
F: FnMut(&T) -> bool,
Retains only the elements specified by the predicate.
sourcepub fn take(&mut self, value: &T) -> Option<T>
pub fn take(&mut self, value: &T) -> Option<T>
Removes and returns the value in the set, if any, that is equal to the given one.
sourcepub fn get(&self, value: &T) -> Option<&T>
pub fn get(&self, value: &T) -> Option<&T>
Returns a reference to the value in the set, if any, that is equal to the given value.
sourcepub fn insert(&mut self, elem: T) -> bool
pub fn insert(&mut self, elem: T) -> bool
Adds a value to the set.
If the set did not have this value present, true is returned.
If the set did have this value present, false is returned.
Trait Implementations
sourceimpl<T: Clone> Clone for SsoHashSet<T>
impl<T: Clone> Clone for SsoHashSet<T>
sourcefn clone(&self) -> SsoHashSet<T>
fn clone(&self) -> SsoHashSet<T>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl<T> Debug for SsoHashSet<T> where
T: Debug,
impl<T> Debug for SsoHashSet<T> where
T: Debug,
sourceimpl<T> Default for SsoHashSet<T>
impl<T> Default for SsoHashSet<T>
sourceimpl<'a, T> Extend<&'a T> for SsoHashSet<T> where
T: 'a + Eq + Hash + Copy,
impl<'a, T> Extend<&'a T> for SsoHashSet<T> where
T: 'a + Eq + Hash + Copy,
sourcefn extend<I: IntoIterator<Item = &'a T>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = &'a T>>(&mut self, iter: I)
Extends a collection with the contents of an iterator. Read more
sourcefn extend_one(&mut self, item: &'a T)
fn extend_one(&mut self, item: &'a T)
extend_one)Extends a collection with exactly one element.
sourcefn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
sourceimpl<T: Eq + Hash> Extend<T> for SsoHashSet<T>
impl<T: Eq + Hash> Extend<T> for SsoHashSet<T>
sourcefn extend<I>(&mut self, iter: I) where
I: IntoIterator<Item = T>,
fn extend<I>(&mut self, iter: I) where
I: IntoIterator<Item = T>,
Extends a collection with the contents of an iterator. Read more
sourcefn extend_one(&mut self, item: T)
fn extend_one(&mut self, item: T)
extend_one)Extends a collection with exactly one element.
sourcefn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
sourceimpl<T: Eq + Hash> FromIterator<T> for SsoHashSet<T>
impl<T: Eq + Hash> FromIterator<T> for SsoHashSet<T>
sourcefn from_iter<I: IntoIterator<Item = T>>(iter: I) -> SsoHashSet<T>
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> SsoHashSet<T>
Creates a value from an iterator. Read more
sourceimpl<T> IntoIterator for SsoHashSet<T>
impl<T> IntoIterator for SsoHashSet<T>
Auto Trait Implementations
impl<T> RefUnwindSafe for SsoHashSet<T> where
T: RefUnwindSafe,
impl<T> Send for SsoHashSet<T> where
T: Send,
impl<T> Sync for SsoHashSet<T> where
T: Sync,
impl<T> Unpin for SsoHashSet<T> where
T: Unpin,
impl<T> UnwindSafe for SsoHashSet<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
impl<'a, T> Captures<'a> for T where
T: ?Sized,
impl<T> Erased 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.