Struct phf::OrderedSet
source · [−]pub struct OrderedSet<T: 'static> { /* private fields */ }
Expand description
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
sourceimpl<T> OrderedSet<T>
impl<T> OrderedSet<T>
sourcepub fn get_key<U: ?Sized>(&self, key: &U) -> Option<&T> where
U: Eq + PhfHash,
T: PhfBorrow<U>,
pub fn get_key<U: ?Sized>(&self, key: &U) -> Option<&T> where
U: Eq + PhfHash,
T: PhfBorrow<U>,
Returns a reference to the set’s internal static instance of the given key.
This can be useful for interning schemes.
sourcepub fn get_index<U: ?Sized>(&self, key: &U) -> Option<usize> where
U: Eq + PhfHash,
T: PhfBorrow<U>,
pub fn get_index<U: ?Sized>(&self, key: &U) -> Option<usize> where
U: Eq + PhfHash,
T: PhfBorrow<U>,
Returns the index of the key within the list used to initialize the ordered set.
sourcepub fn index(&self, index: usize) -> Option<&T>
pub fn index(&self, index: usize) -> Option<&T>
Returns a reference to the key at an index
within the list used to initialize the ordered set. See .get_index(key)
.
sourceimpl<T> OrderedSet<T> where
T: Eq + PhfHash + PhfBorrow<T>,
impl<T> OrderedSet<T> where
T: Eq + PhfHash + PhfBorrow<T>,
sourcepub fn is_disjoint(&self, other: &OrderedSet<T>) -> bool
pub fn is_disjoint(&self, other: &OrderedSet<T>) -> bool
Returns true if other
shares no elements with self
.
sourcepub fn is_subset(&self, other: &OrderedSet<T>) -> bool
pub fn is_subset(&self, other: &OrderedSet<T>) -> bool
Returns true if other
contains all values in self
.
sourcepub fn is_superset(&self, other: &OrderedSet<T>) -> bool
pub fn is_superset(&self, other: &OrderedSet<T>) -> bool
Returns true if self
contains all values in other
.
Trait Implementations
sourceimpl<T> Debug for OrderedSet<T> where
T: Debug,
impl<T> Debug for OrderedSet<T> where
T: Debug,
sourceimpl<'a, T> IntoIterator for &'a OrderedSet<T>
impl<'a, T> IntoIterator for &'a OrderedSet<T>
Auto Trait Implementations
impl<T> RefUnwindSafe for OrderedSet<T> where
T: RefUnwindSafe,
impl<T> Send for OrderedSet<T> where
T: Sync,
impl<T> Sync for OrderedSet<T> where
T: Sync,
impl<T> Unpin for OrderedSet<T>
impl<T> UnwindSafe for OrderedSet<T> where
T: RefUnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more