pub struct Dict<K, V> { /* private fields */ }Implementations§
source§impl<K: Ord, V> Dict<K, V>
impl<K: Ord, V> Dict<K, V>
sourcepub fn iter(&self) -> Iter<'_, K, V>
pub fn iter(&self) -> Iter<'_, K, V>
Gets an iterator over the entries of the dict, sorted by key.
sourcepub fn contains(&self, key: &K) -> bool
pub fn contains(&self, key: &K) -> bool
Returns true if the dict contains a value for the specified key.
sourcepub fn get<'a>(&'a self, key: &K, default: &'a V) -> &V
pub fn get<'a>(&'a self, key: &K, default: &'a V) -> &V
Return a reference of the value for key if key is in the dick, else default value.
sourcepub fn add(&mut self, key: K, value: V) -> bool
pub fn add(&mut self, key: K, value: V) -> bool
Adds a value to the dict. Returns whether the value was newly inserted.
sourcepub fn remove(&mut self, key: &K) -> Option<V>
pub fn remove(&mut self, key: &K) -> Option<V>
Removes a key from the dict, returning the value at the key if the key was previously in the dict.
Trait Implementations§
source§impl<K, V> IntoIterator for Dict<K, V>
impl<K, V> IntoIterator for Dict<K, V>
source§impl<K: PartialEq, V: PartialEq> PartialEq for Dict<K, V>
impl<K: PartialEq, V: PartialEq> PartialEq for Dict<K, V>
source§impl<K: Ord + Clone, V: PartialEq> PartialOrd for Dict<K, V>
impl<K: Ord + Clone, V: PartialEq> PartialOrd for Dict<K, V>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read moreimpl<K: Eq, V: Eq> Eq for Dict<K, V>
impl<K, V> StructuralPartialEq for Dict<K, V>
Auto Trait Implementations§
impl<K, V> Freeze for Dict<K, V>
impl<K, V> RefUnwindSafe for Dict<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for Dict<K, V>
impl<K, V> Sync for Dict<K, V>
impl<K, V> Unpin for Dict<K, V>
impl<K, V> UnwindSafe for Dict<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