[][src]Struct phf::ordered_set::OrderedSet

pub struct OrderedSet<T: 'static> { /* fields omitted */ }

An order-preserving immutable set constructed at compile time.

Unlike a Set, iteration order is guaranteed to match the definition order.

Note

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

Implementations

impl<T> OrderedSet<T>[src]

pub fn len(&self) -> usize[src]

Returns the number of elements in the OrderedSet.

pub fn is_empty(&self) -> bool[src]

Returns true if the OrderedSet contains no elements.

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

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

This can be useful for interning schemes.

pub fn get_index<U: ?Sized>(&self, key: &U) -> Option<usize> where
    U: Eq + PhfHash,
    T: PhfBorrow<U>, 
[src]

Returns the index of the key within the list used to initialize the ordered set.

pub fn index(&self, index: usize) -> Option<&T>[src]

Returns a reference to the key at an index within the list used to initialize the ordered set. See .get_index(key).

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

Returns true if value is in the Set.

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

Notable traits for Iter<'a, T>

impl<'a, T> Iterator for Iter<'a, T> type Item = &'a T;
[src]

Returns an iterator over the values in the set.

Values are returned in the same order in which they were defined.

impl<T> OrderedSet<T> where
    T: Eq + PhfHash + PhfBorrow<T>, 
[src]

pub fn is_disjoint(&self, other: &OrderedSet<T>) -> bool[src]

Returns true if other shares no elements with self.

pub fn is_subset(&self, other: &OrderedSet<T>) -> bool[src]

Returns true if other contains all values in self.

pub fn is_superset(&self, other: &OrderedSet<T>) -> bool[src]

Returns true if self contains all values in other.

Trait Implementations

impl<T> Debug for OrderedSet<T> where
    T: Debug
[src]

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

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?

Auto Trait Implementations

impl<T> RefUnwindSafe for OrderedSet<T> where
    T: RefUnwindSafe

impl<T> Send for OrderedSet<T> where
    T: Send + Sync

impl<T> Sync for OrderedSet<T> where
    T: Sync

impl<T> Unpin for OrderedSet<T> where
    T: Unpin

impl<T> UnwindSafe for OrderedSet<T> where
    T: RefUnwindSafe + UnwindSafe

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<T> From<T> for T[src]

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

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.