Struct rustc_ap_rustc_data_structures::sso::SsoHashSet [−][src]
pub struct SsoHashSet<T> { /* fields omitted */ }
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.
Implementations
impl<T> SsoHashSet<T>
[src]
pub fn new() -> Self
[src]
Creates an empty SsoHashSet
.
pub fn with_capacity(cap: usize) -> Self
[src]
Creates an empty SsoHashSet
with the specified capacity.
pub fn clear(&mut self)
[src]
Clears the set, removing all values.
pub fn capacity(&self) -> usize
[src]
Returns the number of elements the set can hold without reallocating.
pub fn len(&self) -> usize
[src]
Returns the number of elements in the set.
pub fn is_empty(&self) -> bool
[src]
Returns true
if the set contains no elements.
pub fn iter<'a>(&'a self) -> impl Iterator<Item = &'a T>
[src]
An iterator visiting all elements in arbitrary order.
The iterator element type is &'a T
.
pub fn drain(&mut self) -> impl Iterator<Item = T> + '_
[src]
Clears the set, returning all elements in an iterator.
impl<T: Eq + Hash> SsoHashSet<T>
[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]
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]
F: FnMut(&T) -> bool,
Retains only the elements specified by the predicate.
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]
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]
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.
pub fn remove(&mut self, value: &T) -> bool
[src]
Removes a value from the set. Returns whether the value was present in the set.
pub fn contains(&self, value: &T) -> bool
[src]
Returns true
if the set contains a value.
Trait Implementations
impl<T: Clone> Clone for SsoHashSet<T>
[src]
fn clone(&self) -> SsoHashSet<T>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T> Debug for SsoHashSet<T> where
T: Debug,
[src]
T: Debug,
impl<T> Default for SsoHashSet<T>
[src]
impl<'a, T> Extend<&'a T> for SsoHashSet<T> where
T: 'a + Eq + Hash + Copy,
[src]
T: 'a + Eq + Hash + Copy,
fn extend<I: IntoIterator<Item = &'a T>>(&mut self, iter: I)
[src]
fn extend_one(&mut self, item: &'a T)
[src]
fn extend_reserve(&mut self, additional: usize)
[src]
impl<T: Eq + Hash> Extend<T> for SsoHashSet<T>
[src]
fn extend<I>(&mut self, iter: I) where
I: IntoIterator<Item = T>,
[src]
I: IntoIterator<Item = T>,
fn extend_one(&mut self, item: T)
[src]
fn extend_reserve(&mut self, additional: usize)
[src]
impl<T: Eq + Hash> FromIterator<T> for SsoHashSet<T>
[src]
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> SsoHashSet<T>
[src]
impl<T> IntoIterator for SsoHashSet<T>
[src]
type IntoIter = Map<<SsoHashMap<T, ()> as IntoIterator>::IntoIter, fn(_: (T, ())) -> T>
Which kind of iterator are we turning this into?
type Item = <Self::IntoIter as Iterator>::Item
The type of the elements being iterated over.
fn into_iter(self) -> Self::IntoIter
[src]
impl<'a, T> IntoIterator for &'a 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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut Tⓘ
[src]
impl<'a, T> Captures<'a> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Erased for T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,