pub struct VacantEntry<'map, Key, Value, State = RandomState> { /* private fields */ }
Expand description
A view into a vacant entry in the multimap.
Implementations
sourceimpl<'map, Key, Value, State> VacantEntry<'map, Key, Value, State> where
Key: Eq + Hash,
State: BuildHasher,
impl<'map, Key, Value, State> VacantEntry<'map, Key, Value, State> where
Key: Eq + Hash,
State: BuildHasher,
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> RefUnwindSafe for VacantEntry<'map, Key, Value, State> where
Key: RefUnwindSafe,
State: RefUnwindSafe,
Value: RefUnwindSafe,
impl<'map, Key, Value, State> Send for VacantEntry<'map, Key, Value, State> where
Key: Send,
State: Sync,
Value: Send,
impl<'map, Key, Value, State> Sync for VacantEntry<'map, Key, Value, State> where
Key: Sync,
State: Sync,
Value: Sync,
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
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