Struct rustc_ap_rustc_data_structures::sso::SsoHashSet[][src]

pub struct SsoHashSet<T> { /* fields omitted */ }
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.

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]

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]

Returns a copy of the value. Read more

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]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl<T> Default for SsoHashSet<T>[src]

fn default() -> Self[src]

Returns the “default value” for a type. Read more

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]

Extends a collection with the contents of an iterator. Read more

fn extend_one(&mut self, item: &'a T)[src]

🔬 This is a nightly-only experimental API. (extend_one)

Extends a collection with exactly one element.

fn extend_reserve(&mut self, additional: usize)[src]

🔬 This is a nightly-only experimental API. (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]

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]

🔬 This is a nightly-only experimental API. (extend_one)

Extends a collection with exactly one element.

fn extend_reserve(&mut self, additional: usize)[src]

🔬 This is a nightly-only experimental API. (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]

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]

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]

Creates an iterator from a value. Read more

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.

fn into_iter(self) -> Self::IntoIter[src]

Creates an iterator from a value. Read more

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

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T> Instrument for T[src]

fn instrument(self, span: Span) -> Instrumented<Self>[src]

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

fn in_current_span(self) -> Instrumented<Self>[src]

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

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

pub fn into(self) -> U[src]

Performs the conversion.

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

type Owned = T

The resulting type after obtaining ownership.

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]

🔬 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<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

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]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

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

pub fn vzip(self) -> V

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

impl<T> Erased for T[src]