pub struct VacantEntry<'map, Key, Value, State = RandomState> { /* private fields */ }
Expand description
A view into a vacant entry in the multimap.
Implementations§
source§impl<'map, Key, Value, State> VacantEntry<'map, Key, Value, State>
impl<'map, Key, Value, State> VacantEntry<'map, Key, Value, State>
sourcepub fn insert(self, value: Value) -> &'map mut Value
pub fn insert(self, value: Value) -> &'map mut Value
§Examples
use ordered_multimap::ListOrderedMultimap;
use ordered_multimap::list_ordered_multimap::Entry;
let mut map = ListOrderedMultimap::new();
let mut entry = match map.entry("key") {
Entry::Vacant(entry) => entry,
_ => panic!("expected vacant entry")
};
assert_eq!(entry.insert("value"), &"value");
sourcepub fn insert_entry(self, value: Value) -> OccupiedEntry<'map, Key, Value>
pub fn insert_entry(self, value: Value) -> OccupiedEntry<'map, Key, Value>
§Examples
use ordered_multimap::ListOrderedMultimap;
use ordered_multimap::list_ordered_multimap::Entry;
let mut map = ListOrderedMultimap::new();
let mut entry = match map.entry("key") {
Entry::Vacant(entry) => entry,
_ => panic!("expected vacant entry")
};
let mut entry = entry.insert_entry("value");
assert_eq!(entry.get(), &"value");
sourcepub fn into_key(self) -> Key
pub fn into_key(self) -> Key
§Examples
use ordered_multimap::ListOrderedMultimap;
use ordered_multimap::list_ordered_multimap::Entry;
let mut map: ListOrderedMultimap<&str, &str> = ListOrderedMultimap::new();
let mut entry = match map.entry("key") {
Entry::Vacant(entry) => entry,
_ => panic!("expected vacant entry")
};
assert_eq!(entry.into_key(), "key");
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<&str, &str> = ListOrderedMultimap::new();
let mut entry = match map.entry("key") {
Entry::Vacant(entry) => entry,
_ => panic!("expected vacant entry")
};
assert_eq!(entry.key(), &"key");
Trait Implementations§
Auto Trait Implementations§
impl<'map, Key, Value, State> Freeze for VacantEntry<'map, Key, Value, State>where
Key: Freeze,
impl<'map, Key, Value, State> RefUnwindSafe for VacantEntry<'map, Key, Value, State>
impl<'map, Key, Value, State> Send for VacantEntry<'map, Key, Value, State>
impl<'map, Key, Value, State> Sync for VacantEntry<'map, Key, Value, State>
impl<'map, Key, Value, State> Unpin for VacantEntry<'map, Key, Value, State>where
Key: Unpin,
impl<'map, Key, Value, State = RandomState> !UnwindSafe for VacantEntry<'map, Key, Value, State>
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