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, mut 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]

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]

impl<T> Debug for SsoHashSet<T> where
    T: Debug
[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<T: Eq + Hash> Extend<T> for SsoHashSet<T>[src]

impl<T: Eq + Hash> FromIterator<T> for 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.

impl<'a, T> IntoIterator for &'a SsoHashSet<T>[src]

type IntoIter = Map<<&'a SsoHashMap<T, ()> as IntoIterator>::IntoIter, fn(_: (&'a T, &'a ())) -> &'a 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.

Auto Trait Implementations

impl<T> RefUnwindSafe for SsoHashSet<T> where
    T: RefUnwindSafe
[src]

impl<T> Send for SsoHashSet<T> where
    T: Send
[src]

impl<T> Sync for SsoHashSet<T> where
    T: Sync
[src]

impl<T> Unpin for SsoHashSet<T> where
    T: Unpin
[src]

impl<T> UnwindSafe for SsoHashSet<T> where
    T: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<'a, T> Captures<'a> for T where
    T: ?Sized
[src]

impl<T> Erased for T[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,