Set

Struct Set 

Source
pub struct Set<T: 'static> { /* private fields */ }
Expand description

An immutable set constructed at compile time.

§Note

The fields of this struct are public so that they may be initialized by the phf_set! macro and code generation. They are subject to change at any time and should never be accessed directly.

Implementations§

Source§

impl<T> Set<T>

Source

pub const fn len(&self) -> usize

Returns the number of elements in the Set.

Source

pub const fn is_empty(&self) -> bool

Returns true if the Set contains no elements.

Source

pub fn get_key<U>(&self, key: &U) -> Option<&T>
where U: Eq + PhfHash + ?Sized, T: PhfBorrow<U>,

Returns a reference to the set’s internal static instance of the given key.

This can be useful for interning schemes.

Source

pub fn contains<U>(&self, value: &U) -> bool
where U: Eq + PhfHash + ?Sized, T: PhfBorrow<U>,

Returns true if value is in the Set.

Source

pub fn iter(&self) -> Iter<'_, T>

Returns an iterator over the values in the set.

Values are returned in an arbitrary but fixed order.

Source§

impl<T> Set<T>
where T: Eq + PhfHash + PhfBorrow<T>,

Source

pub fn is_disjoint(&self, other: &Set<T>) -> bool

Returns true if other shares no elements with self.

Source

pub fn is_subset(&self, other: &Set<T>) -> bool

Returns true if other contains all values in self.

Source

pub fn is_superset(&self, other: &Set<T>) -> bool

Returns true if self contains all values in other.

Trait Implementations§

Source§

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

Source§

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

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

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

Source§

type Item = &'a T

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'a, T>

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

fn into_iter(self) -> Iter<'a, T>

Creates an iterator from a value. Read more
Source§

impl<T> PartialEq for Set<T>
where T: PartialEq,

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T> Eq for Set<T>
where T: Eq,

Auto Trait Implementations§

§

impl<T> Freeze for Set<T>

§

impl<T> RefUnwindSafe for Set<T>
where T: RefUnwindSafe,

§

impl<T> Send for Set<T>
where T: Sync,

§

impl<T> Sync for Set<T>
where T: Sync,

§

impl<T> Unpin for Set<T>

§

impl<T> UnwindSafe for Set<T>
where T: RefUnwindSafe,

Blanket Implementations§

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 40 bytes