pub struct OccupiedEntry<'map, Key, Value> { /* private fields */ }
Expand description
A view into an occupied entry in the multimap.
Implementations
sourceimpl<'map, Key, Value> OccupiedEntry<'map, Key, Value>
impl<'map, Key, Value> OccupiedEntry<'map, Key, Value>
sourcepub fn append(&mut self, value: Value)
pub fn append(&mut self, value: Value)
Examples
use ordered_multimap::ListOrderedMultimap;
use ordered_multimap::list_ordered_multimap::Entry;
let mut map = ListOrderedMultimap::new();
map.insert("key", "value1");
let mut entry = match map.entry("key") {
Entry::Occupied(entry) => entry,
_ => panic!("expected occupied entry")
};
entry.append("value2");
let mut iter = map.get_all(&"key");
assert_eq!(iter.next(), Some(&"value1"));
assert_eq!(iter.next(), Some(&"value2"));
assert_eq!(iter.next(), None);
sourcepub fn get(&self) -> &Value
pub fn get(&self) -> &Value
Examples
use ordered_multimap::ListOrderedMultimap;
use ordered_multimap::list_ordered_multimap::Entry;
let mut map = ListOrderedMultimap::new();
map.insert("key", "value");
let mut entry = match map.entry("key") {
Entry::Occupied(entry) => entry,
_ => panic!("expected occupied entry")
};
assert_eq!(entry.get(), &"value");
sourcepub fn get_mut(&mut self) -> &mut Value
pub fn get_mut(&mut self) -> &mut Value
Examples
use ordered_multimap::ListOrderedMultimap;
use ordered_multimap::list_ordered_multimap::Entry;
let mut map = ListOrderedMultimap::new();
map.insert("key", "value");
let mut entry = match map.entry("key") {
Entry::Occupied(entry) => entry,
_ => panic!("expected occupied entry")
};
assert_eq!(entry.get(), &mut "value");
sourcepub fn insert(&mut self, value: Value) -> Value
pub fn insert(&mut self, value: Value) -> Value
Examples
use ordered_multimap::ListOrderedMultimap;
use ordered_multimap::list_ordered_multimap::Entry;
let mut map = ListOrderedMultimap::new();
map.insert("key", "value1");
let mut entry = match map.entry("key") {
Entry::Occupied(entry) => entry,
_ => panic!("expected occupied entry")
};
entry.insert("value2");
assert_eq!(map.get(&"key"), Some(&"value2"));
sourcepub fn insert_all(&mut self, value: Value) -> EntryValuesDrain<'_, Key, Value>ⓘNotable traits for EntryValuesDrain<'_, Key, Value>impl<Key, Value> Iterator for EntryValuesDrain<'_, Key, Value> type Item = Value;
pub fn insert_all(&mut self, value: Value) -> EntryValuesDrain<'_, Key, Value>ⓘNotable traits for EntryValuesDrain<'_, Key, Value>impl<Key, Value> Iterator for EntryValuesDrain<'_, Key, Value> type Item = Value;
Examples
use ordered_multimap::ListOrderedMultimap;
use ordered_multimap::list_ordered_multimap::Entry;
let mut map = ListOrderedMultimap::new();
map.insert("key", "value1");
let mut entry = match map.entry("key") {
Entry::Occupied(entry) => entry,
_ => panic!("expected occupied entry")
};
entry.append("value2");
let mut iter = entry.insert_all("value3");
assert_eq!(iter.next(), Some("value1"));
assert_eq!(iter.next(), Some("value2"));
assert_eq!(iter.next(), None);
sourcepub fn into_mut(self) -> &'map mut Value
pub fn into_mut(self) -> &'map mut Value
Examples
use ordered_multimap::ListOrderedMultimap;
use ordered_multimap::list_ordered_multimap::Entry;
let mut map = ListOrderedMultimap::new();
map.insert("key", "value");
let mut entry = match map.entry("key") {
Entry::Occupied(entry) => entry,
_ => panic!("expected occupied entry")
};
assert_eq!(entry.into_mut(), &mut "value");
sourcepub fn iter(&self) -> EntryValues<'_, Key, Value>ⓘNotable traits for EntryValues<'map, Key, Value>impl<'map, Key, Value> Iterator for EntryValues<'map, Key, Value> type Item = &'map Value;
pub fn iter(&self) -> EntryValues<'_, Key, Value>ⓘNotable traits for EntryValues<'map, Key, Value>impl<'map, Key, Value> Iterator for EntryValues<'map, Key, Value> type Item = &'map Value;
Examples
use ordered_multimap::ListOrderedMultimap;
use ordered_multimap::list_ordered_multimap::Entry;
let mut map = ListOrderedMultimap::new();
map.insert("key", "value1");
let mut entry = match map.entry("key") {
Entry::Occupied(entry) => entry,
_ => panic!("expected occupied entry")
};
entry.append("value2");
let mut iter = entry.iter();
assert_eq!(iter.next(), Some(&"value1"));
assert_eq!(iter.next(), Some(&"value2"));
assert_eq!(iter.next(), None);
sourcepub fn iter_mut(&mut self) -> EntryValuesMut<'_, Key, Value>ⓘNotable traits for EntryValuesMut<'map, Key, Value>impl<'map, Key, Value> Iterator for EntryValuesMut<'map, Key, Value> type Item = &'map mut Value;
pub fn iter_mut(&mut self) -> EntryValuesMut<'_, Key, Value>ⓘNotable traits for EntryValuesMut<'map, Key, Value>impl<'map, Key, Value> Iterator for EntryValuesMut<'map, Key, Value> type Item = &'map mut Value;
Examples
use ordered_multimap::ListOrderedMultimap;
use ordered_multimap::list_ordered_multimap::Entry;
let mut map = ListOrderedMultimap::new();
map.insert("key", "value1");
let mut entry = match map.entry("key") {
Entry::Occupied(entry) => entry,
_ => panic!("expected occupied entry")
};
entry.append("value2");
let mut iter = entry.iter_mut();
assert_eq!(iter.next(), Some(&mut "value1"));
assert_eq!(iter.next(), Some(&mut "value2"));
assert_eq!(iter.next(), None);
sourcepub fn key(&self) -> &Key
pub fn key(&self) -> &Key
Examples
use ordered_multimap::ListOrderedMultimap;
use ordered_multimap::list_ordered_multimap::Entry;
let mut map = ListOrderedMultimap::new();
map.insert("key", "value1");
let mut entry = match map.entry("key") {
Entry::Occupied(entry) => entry,
_ => panic!("expected occupied entry")
};
assert_eq!(entry.key(), &"key");
sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Examples
use ordered_multimap::ListOrderedMultimap;
use ordered_multimap::list_ordered_multimap::Entry;
let mut map = ListOrderedMultimap::new();
map.insert("key", "value1");
let mut entry = match map.entry("key") {
Entry::Occupied(entry) => entry,
_ => panic!("expected occupied entry")
};
assert_eq!(entry.len(), 1);
entry.append("value2");
assert_eq!(entry.len(), 2);
sourcepub fn remove(self) -> Value
pub fn remove(self) -> Value
Examples
use ordered_multimap::ListOrderedMultimap;
use ordered_multimap::list_ordered_multimap::Entry;
let mut map = ListOrderedMultimap::new();
map.insert("key", "value");
let mut entry = match map.entry("key") {
Entry::Occupied(entry) => entry,
_ => panic!("expected occupied entry")
};
assert_eq!(entry.remove(), "value");
sourcepub fn remove_all(self) -> EntryValuesDrain<'map, Key, Value>ⓘNotable traits for EntryValuesDrain<'_, Key, Value>impl<Key, Value> Iterator for EntryValuesDrain<'_, Key, Value> type Item = Value;
pub fn remove_all(self) -> EntryValuesDrain<'map, Key, Value>ⓘNotable traits for EntryValuesDrain<'_, Key, Value>impl<Key, Value> Iterator for EntryValuesDrain<'_, Key, Value> type Item = Value;
Examples
use ordered_multimap::ListOrderedMultimap;
use ordered_multimap::list_ordered_multimap::Entry;
let mut map = ListOrderedMultimap::new();
map.insert("key", "value1");
let mut entry = match map.entry("key") {
Entry::Occupied(entry) => entry,
_ => panic!("expected occupied entry")
};
entry.append("value2");
let mut iter = entry.remove_all();
assert_eq!(iter.next(), Some("value1"));
assert_eq!(iter.next(), Some("value2"));
assert_eq!(iter.next(), None);
sourcepub fn remove_entry(self) -> (Key, Value)
pub fn remove_entry(self) -> (Key, Value)
Examples
use ordered_multimap::ListOrderedMultimap;
use ordered_multimap::list_ordered_multimap::Entry;
let mut map = ListOrderedMultimap::new();
map.insert("key", "value");
let mut entry = match map.entry("key") {
Entry::Occupied(entry) => entry,
_ => panic!("expected occupied entry")
};
assert_eq!(entry.remove_entry(), ("key", "value"));
sourcepub fn remove_entry_all(self) -> (Key, EntryValuesDrain<'map, Key, Value>)
pub fn remove_entry_all(self) -> (Key, EntryValuesDrain<'map, Key, Value>)
Examples
use ordered_multimap::ListOrderedMultimap;
use ordered_multimap::list_ordered_multimap::Entry;
let mut map = ListOrderedMultimap::new();
map.insert("key", "value1");
let mut entry = match map.entry("key") {
Entry::Occupied(entry) => entry,
_ => panic!("expected occupied entry")
};
entry.append("value2");
let (key, mut iter) = entry.remove_entry_all();
assert_eq!(key, "key");
assert_eq!(iter.next(), Some("value1"));
assert_eq!(iter.next(), Some("value2"));
assert_eq!(iter.next(), None);
Trait Implementations
Auto Trait Implementations
impl<'map, Key, Value> RefUnwindSafe for OccupiedEntry<'map, Key, Value> where
Key: RefUnwindSafe,
Value: RefUnwindSafe,
impl<'map, Key, Value> Send for OccupiedEntry<'map, Key, Value> where
Key: Send,
Value: Send,
impl<'map, Key, Value> Sync for OccupiedEntry<'map, Key, Value> where
Key: Sync,
Value: Sync,
impl<'map, Key, Value> Unpin for OccupiedEntry<'map, Key, Value>
impl<'map, Key, Value> !UnwindSafe for OccupiedEntry<'map, Key, Value>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more