Struct phf::OrderedSet [] [src]

pub struct OrderedSet<T: 'static> {
    // some 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.

Methods

impl<T> OrderedSet<T>
[src]

fn len(&self) -> usize

Returns the number of elements in the OrderedSet.

fn is_empty(&self) -> bool

Returns true if the OrderedSet contains no elements.

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

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

This can be useful for interning schemes.

fn get_index<U: ?Sized>(&self, key: &U) -> Option<usize> where U: Eq + PhfHash, T: Borrow<U>

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

fn index(&self, index: usize) -> Option<&T>

Returns references to both the key and values at an index within the list used to initialize the ordered map. See .get_index(key).

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

Returns true if value is in the Set.

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

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
[src]

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

Returns true if other shares no elements with self.

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

Returns true if other contains all values in self.

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

Returns true if self contains all values in other.

Trait Implementations

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

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

Formats the value using the given formatter.

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?

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

Creates an iterator from a value. Read more