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 HashIndex
.
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::HashIndex;
let hashindex: HashIndex<u64, u32> = HashIndex::default();
assert_eq!(hashindex.entry(11).key(), &11);
Sourcepub fn into_key(self) -> K
pub fn into_key(self) -> K
Takes ownership of the key.
§Examples
use scc::HashIndex;
use scc::hash_index::Entry;
let hashindex: HashIndex<u64, u32> = HashIndex::default();
if let Entry::Vacant(v) = hashindex.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::HashIndex;
use scc::hash_index::Entry;
let hashindex: HashIndex<u64, u32> = HashIndex::default();
if let Entry::Vacant(o) = hashindex.entry(19) {
o.insert_entry(29);
}
assert_eq!(hashindex.peek_with(&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