pub struct OrderedSet<K: 'static> { /* private fields */ }
Expand description
An order-preserving set which can be constructed at compile time.
“Order-preserving” means iteration order is guaranteed to match the definition order.
Implementations§
Source§impl<K> OrderedSet<K>
impl<K> OrderedSet<K>
Sourcepub fn get<T: ?Sized>(&self, key: &T) -> Option<&K>where
K: PhfKeyProxy<T>,
pub fn get<T: ?Sized>(&self, key: &T) -> Option<&K>where
K: PhfKeyProxy<T>,
Returns a reference to the value that key
maps to.
Sourcepub fn contains<T: ?Sized>(&self, key: &T) -> boolwhere
K: PhfKeyProxy<T>,
pub fn contains<T: ?Sized>(&self, key: &T) -> boolwhere
K: PhfKeyProxy<T>,
Determines if key
is in the OrderedMap
.
Sourcepub fn get_index<T: ?Sized>(&self, key: &T) -> Option<usize>where
K: PhfKeyProxy<T>,
pub fn get_index<T: ?Sized>(&self, key: &T) -> Option<usize>where
K: PhfKeyProxy<T>,
Returns the index of the key within the list used to initialize the ordered map.
Sourcepub fn index(&self, index: usize) -> Option<&K>
pub fn index(&self, index: usize) -> Option<&K>
Returns references to both the key and values at an index
within the list used to initialize the ordered map. See .get_index(key)
.
Sourcepub fn iter(&self) -> Iter<'_, K> ⓘ
pub fn iter(&self) -> Iter<'_, K> ⓘ
Returns an iterator over the values in the set.
Values are returned in the same order in which they were defined.
Sourcepub fn is_disjoint(&self, other: &OrderedSet<K>) -> boolwhere
K: PhfKeyProxy<K>,
pub fn is_disjoint(&self, other: &OrderedSet<K>) -> boolwhere
K: PhfKeyProxy<K>,
Returns true if other
shares no elements with self
.
Sourcepub fn is_subset(&self, other: &OrderedSet<K>) -> boolwhere
K: PhfKeyProxy<K>,
pub fn is_subset(&self, other: &OrderedSet<K>) -> boolwhere
K: PhfKeyProxy<K>,
Returns true if other
contains all values in self
.
Sourcepub fn is_superset(&self, other: &OrderedSet<K>) -> boolwhere
K: PhfKeyProxy<K>,
pub fn is_superset(&self, other: &OrderedSet<K>) -> boolwhere
K: PhfKeyProxy<K>,
Returns true if self
contains all values in other
.
Trait Implementations§
Source§impl<T> Debug for OrderedSet<T>where
T: Debug,
impl<T> Debug for OrderedSet<T>where
T: Debug,
Source§impl<K> Default for OrderedSet<K>
impl<K> Default for OrderedSet<K>
Source§impl<'a, T> IntoIterator for &'a OrderedSet<T>
impl<'a, T> IntoIterator for &'a OrderedSet<T>
Source§impl<T> PartialEq for OrderedSet<T>where
T: PartialEq,
impl<T> PartialEq for OrderedSet<T>where
T: PartialEq,
impl<T> Eq for OrderedSet<T>where
T: Eq,
Auto Trait Implementations§
impl<K> Freeze for OrderedSet<K>
impl<K> RefUnwindSafe for OrderedSet<K>where
K: RefUnwindSafe,
impl<K> Send for OrderedSet<K>where
K: Sync,
impl<K> Sync for OrderedSet<K>where
K: Sync,
impl<K> Unpin for OrderedSet<K>
impl<K> UnwindSafe for OrderedSet<K>where
K: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more