Struct phf::set::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) -> boolwhere 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>

§

type Item = &'a T

The type of the elements being iterated over.
§

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

Auto Trait Implementations§

§

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 Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.