Struct scc::hash_map::VacantEntry
source · pub struct VacantEntry<'h, K, V, H = RandomState>where
H: BuildHasher,{ /* private fields */ }
Expand description
VacantEntry
is a view into a vacant entry in a HashMap
.
Implementations§
source§impl<'h, K, V, H> VacantEntry<'h, K, V, H>
impl<'h, K, V, H> VacantEntry<'h, K, V, H>
sourcepub fn key(&self) -> &K
pub fn key(&self) -> &K
Gets a reference to the key.
§Examples
use scc::HashMap;
let hashmap: HashMap<u64, u32> = HashMap::default();
assert_eq!(hashmap.entry(11).key(), &11);
sourcepub fn into_key(self) -> K
pub fn into_key(self) -> K
Takes ownership of the key.
§Examples
use scc::HashMap;
use scc::hash_map::Entry;
let hashmap: HashMap<u64, u32> = HashMap::default();
if let Entry::Vacant(v) = hashmap.entry(17) {
assert_eq!(v.into_key(), 17);
};
sourcepub fn insert_entry(self, val: V) -> OccupiedEntry<'h, K, V, H>
pub fn insert_entry(self, val: V) -> OccupiedEntry<'h, K, V, H>
Sets the value of the entry with its key, and returns an OccupiedEntry
.
§Examples
use scc::HashMap;
use scc::hash_map::Entry;
let hashmap: HashMap<u64, u32> = HashMap::default();
if let Entry::Vacant(o) = hashmap.entry(19) {
o.insert_entry(29);
}
assert_eq!(hashmap.read(&19, |_, v| *v), Some(29));
Trait Implementations§
Auto Trait Implementations§
impl<'h, K, V, H> Freeze for VacantEntry<'h, K, V, H>where
K: Freeze,
impl<'h, K, V, H> RefUnwindSafe for VacantEntry<'h, K, V, H>
impl<'h, K, V, H> Send for VacantEntry<'h, K, V, H>
impl<'h, K, V, H> Sync for VacantEntry<'h, K, V, H>
impl<'h, K, V, H> Unpin for VacantEntry<'h, K, V, H>where
K: Unpin,
impl<'h, K, V, H = RandomState> !UnwindSafe for VacantEntry<'h, K, V, H>
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