Struct rustc_data_structures::sso::set::SsoHashSet [−][src]
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
impl<T> SsoHashSet<T>[src]
impl<T> SsoHashSet<T>[src]pub fn with_capacity(cap: usize) -> Self[src]
pub fn with_capacity(cap: usize) -> Self[src]Creates an empty SsoHashSet with the specified capacity.
pub fn capacity(&self) -> usize[src]
pub fn capacity(&self) -> usize[src]Returns the number of elements the set can hold without reallocating.
impl<T: Eq + Hash> SsoHashSet<T>[src]
impl<T: Eq + Hash> SsoHashSet<T>[src]pub fn reserve(&mut self, additional: usize)[src]
pub fn reserve(&mut self, additional: usize)[src]Reserves capacity for at least additional more elements to be inserted
in the SsoHashSet. The collection may reserve more space to avoid
frequent reallocations.
pub fn shrink_to_fit(&mut self)[src]
pub fn shrink_to_fit(&mut self)[src]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.
pub fn retain<F>(&mut self, f: F) where
F: FnMut(&T) -> bool, [src]
pub fn retain<F>(&mut self, f: F) where
F: FnMut(&T) -> bool, [src]Retains only the elements specified by the predicate.
pub fn take(&mut self, value: &T) -> Option<T>[src]
pub fn take(&mut self, value: &T) -> Option<T>[src]Removes and returns the value in the set, if any, that is equal to the given one.
pub fn get(&self, value: &T) -> Option<&T>[src]
pub fn get(&self, value: &T) -> Option<&T>[src]Returns a reference to the value in the set, if any, that is equal to the given value.
pub fn insert(&mut self, elem: T) -> bool[src]
pub fn insert(&mut self, elem: T) -> bool[src]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
impl<T: Clone> Clone for SsoHashSet<T>[src]
impl<T: Clone> Clone for SsoHashSet<T>[src]fn clone(&self) -> SsoHashSet<T>[src]
fn clone(&self) -> SsoHashSet<T>[src]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 for SsoHashSet<T> where
T: Debug, [src]
impl<T> Debug for SsoHashSet<T> where
T: Debug, [src]impl<T> Default for SsoHashSet<T>[src]
impl<T> Default for SsoHashSet<T>[src]impl<'a, T> Extend<&'a T> for SsoHashSet<T> where
T: 'a + Eq + Hash + Copy, [src]
impl<'a, T> Extend<&'a T> for SsoHashSet<T> where
T: 'a + Eq + Hash + Copy, [src]fn extend<I: IntoIterator<Item = &'a T>>(&mut self, iter: I)[src]
fn extend<I: IntoIterator<Item = &'a T>>(&mut self, iter: I)[src]Extends a collection with the contents of an iterator. Read more
fn extend_one(&mut self, item: &'a T)[src]
fn extend_one(&mut self, item: &'a T)[src]extend_one)Extends a collection with exactly one element.
fn extend_reserve(&mut self, additional: usize)[src]
fn extend_reserve(&mut self, additional: usize)[src]extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
impl<T: Eq + Hash> Extend<T> for SsoHashSet<T>[src]
impl<T: Eq + Hash> Extend<T> for SsoHashSet<T>[src]fn extend<I>(&mut self, iter: I) where
I: IntoIterator<Item = T>, [src]
fn extend<I>(&mut self, iter: I) where
I: IntoIterator<Item = T>, [src]Extends a collection with the contents of an iterator. Read more
fn extend_one(&mut self, item: T)[src]
fn extend_one(&mut self, item: T)[src]extend_one)Extends a collection with exactly one element.
fn extend_reserve(&mut self, additional: usize)[src]
fn extend_reserve(&mut self, additional: usize)[src]extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
impl<T: Eq + Hash> FromIterator<T> for SsoHashSet<T>[src]
impl<T: Eq + Hash> FromIterator<T> for SsoHashSet<T>[src]fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> SsoHashSet<T>[src]
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> SsoHashSet<T>[src]Creates a value from an iterator. Read more
impl<T> IntoIterator for SsoHashSet<T>[src]
impl<T> IntoIterator for SsoHashSet<T>[src]Auto Trait Implementations
impl<T> RefUnwindSafe for SsoHashSet<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for SsoHashSet<T> where
T: Send,
T: Send,
impl<T> Sync for SsoHashSet<T> where
T: Sync,
T: Sync,
impl<T> Unpin for SsoHashSet<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for SsoHashSet<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]pub fn borrow_mut(&mut self) -> &mut T[src]
pub fn borrow_mut(&mut self) -> &mut T[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone, [src]
impl<T> ToOwned for T where
T: Clone, [src]type Owned = T
type Owned = TThe resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn to_owned(&self) -> T[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)[src]
pub fn clone_into(&self, target: &mut T)[src]🔬 This is a nightly-only experimental API. (toowned_clone_into)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<'a, T> Captures<'a> for T where
T: ?Sized, [src]
T: ?Sized,