pub struct OrderedMap<K, V> { /* private fields */ }
Expand description
A map that preserves the insertion order of keys.
Implementations§
source§impl<K, V> OrderedMap<K, V>
impl<K, V> OrderedMap<K, V>
source§impl<K, V> OrderedMap<K, V>
impl<K, V> OrderedMap<K, V>
sourcepub fn get<Q>(&self, key: &Q) -> Option<&V>
pub fn get<Q>(&self, key: &Q) -> Option<&V>
Retrieves a reference to the value corresponding to the key.
sourcepub fn get_mut<Q>(&mut self, key: &Q) -> Option<&mut V>
pub fn get_mut<Q>(&mut self, key: &Q) -> Option<&mut V>
Retrieves a mutable reference to the value corresponding to the key.
sourcepub fn get_index(&self, index: usize) -> Option<&V>
pub fn get_index(&self, index: usize) -> Option<&V>
Returns the reference to the element with the key at the given position.
sourcepub fn get_index_mut(&mut self, index: usize) -> Option<&mut V>
pub fn get_index_mut(&mut self, index: usize) -> Option<&mut V>
Returns the mutable reference to the element with the key at the given position.
sourcepub fn contains_key<Q>(&self, key: &Q) -> bool
pub fn contains_key<Q>(&self, key: &Q) -> bool
Returns true
if the map contains the given key.
sourcepub fn remove<Q>(&mut self, key: &Q) -> Option<V>
pub fn remove<Q>(&mut self, key: &Q) -> Option<V>
Removes a key from the map, returning its value if it was present.
sourcepub fn remove_index(&mut self, index: usize) -> Option<V>
pub fn remove_index(&mut self, index: usize) -> Option<V>
Removes the element at the given position.
sourcepub fn try_retain<F, E>(&mut self, f: F) -> Result<(), E>
pub fn try_retain<F, E>(&mut self, f: F) -> Result<(), E>
Remove all elements that does not matches the predicate. If the predicate returns an error, the operation is stopped and the error is returned.
source§impl<K, V> OrderedMap<K, V>
impl<K, V> OrderedMap<K, V>
Trait Implementations§
source§impl<K: Clone, V: Clone> Clone for OrderedMap<K, V>
impl<K: Clone, V: Clone> Clone for OrderedMap<K, V>
source§fn clone(&self) -> OrderedMap<K, V>
fn clone(&self) -> OrderedMap<K, V>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<K, V> Debug for OrderedMap<K, V>
impl<K, V> Debug for OrderedMap<K, V>
source§impl<K, V> Default for OrderedMap<K, V>
impl<K, V> Default for OrderedMap<K, V>
source§impl<'a, K, V> IntoIterator for &'a OrderedMap<K, V>
impl<'a, K, V> IntoIterator for &'a OrderedMap<K, V>
source§impl<K, V> IntoIterator for OrderedMap<K, V>
impl<K, V> IntoIterator for OrderedMap<K, V>
source§impl<K, V> PartialEq for OrderedMap<K, V>
impl<K, V> PartialEq for OrderedMap<K, V>
impl<K, V> Eq for OrderedMap<K, V>
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: UnwindSafe,
V: UnwindSafe,
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)