pub struct OrderedMap<K: 'static, V: 'static>(/* private fields */);Expand description
An order-preserving immutable map with lookup via a perfect hash function.
Constructable at compile time with a BuildOrderedMap. Unlike a Map, iteration order is guaranteed to
match the definition order.
Internally, this is a wrapper for phf::OrderedMap from the excellent
phf crate.
This API requires the following crate feature to be activated: map
Implementations§
Source§impl<K, V> OrderedMap<K, V>
impl<K, V> OrderedMap<K, V>
pub const fn len(&self) -> usize
pub const fn is_empty(&self) -> bool
pub fn contains_key<T>(&self, key: &T) -> bool
pub fn get<T>(&self, key: &T) -> Option<&V>
pub fn get_key<T>(&self, key: &T) -> Option<&K>
pub fn get_entry<T>(&self, key: &T) -> Option<(&K, &V)>
pub fn get_index<T>(&self, key: &T) -> Option<usize>
pub fn index<T>(&self, index: usize) -> Option<(&K, &V)>
pub fn entries(&self) -> Entries<'_, K, V>
pub fn keys(&self) -> Keys<'_, K, V>
pub fn values(&self) -> Values<'_, K, V>
Sourcepub const fn init_raw(map: OrderedMap<K, V>) -> OrderedMap<K, V>
pub const fn init_raw(map: OrderedMap<K, V>) -> OrderedMap<K, V>
An implementation detail. You shouldn’t need to call this function.
Auto Trait Implementations§
impl<K, V> Freeze for OrderedMap<K, V>
impl<K, V> RefUnwindSafe for OrderedMap<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for OrderedMap<K, V>
impl<K, V> Sync for OrderedMap<K, V>
impl<K, V> Unpin for OrderedMap<K, V>
impl<K, V> UnwindSafe for OrderedMap<K, V>where
K: RefUnwindSafe,
V: 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