rustc_trait_selection::infer::canonical::ir::data_structures

Struct 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§

Source§

impl<T> SsoHashSet<T>

Source

pub fn new() -> SsoHashSet<T>

Creates an empty SsoHashSet.

Source

pub fn with_capacity(cap: usize) -> SsoHashSet<T>

Creates an empty SsoHashSet with the specified capacity.

Source

pub fn clear(&mut self)

Clears the set, removing all values.

Source

pub fn capacity(&self) -> usize

Returns the number of elements the set can hold without reallocating.

Source

pub fn len(&self) -> usize

Returns the number of elements in the set.

Source

pub fn is_empty(&self) -> bool

Returns true if the set contains no elements.

Source

pub fn iter(&self) -> impl Iterator<Item = &T>

An iterator visiting all elements in arbitrary order. The iterator element type is &'a T.

Source

pub fn drain(&mut self) -> impl Iterator<Item = T>

Clears the set, returning all elements in an iterator.

Source§

impl<T> SsoHashSet<T>
where T: Eq + Hash,

Source

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.

Source

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.

Source

pub fn retain<F>(&mut self, f: F)
where F: FnMut(&T) -> bool,

Retains only the elements specified by the predicate.

Source

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.

Source

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.

Source

pub fn insert(&mut self, elem: T) -> bool

Adds a value to the set.

Returns whether the value was newly inserted. That is:

  • If the set did not previously contain this value, true is returned.
  • If the set already contained this value, false is returned.
Source

pub fn remove(&mut self, value: &T) -> bool

Removes a value from the set. Returns whether the value was present in the set.

Source

pub fn contains(&self, value: &T) -> bool

Returns true if the set contains a value.

Trait Implementations§

Source§

impl<T> Clone for SsoHashSet<T>
where T: Clone,

Source§

fn clone(&self) -> SsoHashSet<T>

Returns a copy of the value. Read more
Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T> Debug for SsoHashSet<T>
where T: Debug,

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<T> Default for SsoHashSet<T>

Source§

fn default() -> SsoHashSet<T>

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

impl<'a, T> Extend<&'a T> for SsoHashSet<T>
where T: 'a + Eq + Hash + Copy,

Source§

fn extend<I>(&mut self, iter: I)
where I: IntoIterator<Item = &'a T>,

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

fn extend_one(&mut self, _: &'a T)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<T> Extend<T> for SsoHashSet<T>
where T: Eq + Hash,

Source§

fn extend<I>(&mut self, iter: I)
where I: IntoIterator<Item = T>,

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

fn extend_one(&mut self, item: T)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<T> FromIterator<T> for SsoHashSet<T>
where T: Eq + Hash,

Source§

fn from_iter<I>(iter: I) -> SsoHashSet<T>
where I: IntoIterator<Item = T>,

Creates a value from an iterator. Read more
Source§

impl<'a, T> IntoIterator for &'a SsoHashSet<T>

Source§

type IntoIter = Map<Either<Map<Iter<'a, (T, ())>, fn(_: &'a (T, ())) -> (&'a T, &'a ())>, Iter<'a, T, ()>>, fn(_: (&'a T, &'a ())) -> &'a T>

Which kind of iterator are we turning this into?
Source§

type Item = &'a T

The type of the elements being iterated over.
Source§

fn into_iter( self, ) -> Map<Either<Map<Iter<'a, (T, ())>, fn(_: &'a (T, ())) -> (&'a T, &'a ())>, Iter<'a, T, ()>>, fn(_: (&'a T, &'a ())) -> &'a T>

Creates an iterator from a value. Read more
Source§

impl<T> IntoIterator for SsoHashSet<T>

Source§

type IntoIter = Map<Either<IntoIter<(T, ()), 8>, IntoIter<T, ()>>, fn(_: (T, ())) -> T>

Which kind of iterator are we turning this into?
Source§

type Item = T

The type of the elements being iterated over.
Source§

fn into_iter( self, ) -> Map<Either<IntoIter<(T, ()), 8>, IntoIter<T, ()>>, fn(_: (T, ())) -> T>

Creates an iterator from a value. Read more

Auto Trait Implementations§

§

impl<T> DynSend for SsoHashSet<T>
where T: DynSend,

§

impl<T> DynSync for SsoHashSet<T>
where T: DynSync,

§

impl<T> Freeze for SsoHashSet<T>
where T: Freeze,

§

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§

Source§

impl<T> Aligned for T

Source§

const ALIGN: Alignment = _

Alignment of Self.
Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<T, R> CollectAndApply<T, R> for T

§

fn collect_and_apply<I, F>(iter: I, f: F) -> R
where I: Iterator<Item = T>, F: FnOnce(&[T]) -> R,

Equivalent to f(&iter.collect::<Vec<_>>()).

§

type Output = R

Source§

impl<T> Filterable for T

Source§

fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>

Creates a filterable data provider with the given name for debugging. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

fn in_current_span(self) -> Instrumented<Self>

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

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<P> IntoQueryParam<P> for P

Source§

impl<T> MaybeResult<T> for T

Source§

type Error = !

Source§

fn from(_: Result<T, <T as MaybeResult<T>>::Error>) -> T

Source§

fn to_result(self) -> Result<T, <T as MaybeResult<T>>::Error>

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize = _

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
§

impl<I, T, U> Upcast<I, U> for T
where U: UpcastFrom<I, T>,

§

fn upcast(self, interner: I) -> U

§

impl<I, T> UpcastFrom<I, T> for T

§

fn upcast_from(from: T, _tcx: I) -> T

Source§

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

Source§

fn vzip(self) -> V

§

impl<Tcx, T> Value<Tcx> for T
where Tcx: DepContext,

§

default fn from_cycle_error( tcx: Tcx, cycle_error: &CycleError, _guar: ErrorGuaranteed, ) -> T

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

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

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T
where T: Send + Sync,

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.