pub struct VacantEntry<'a, T, S, A = Global>where
A: Allocator,{ /* private fields */ }Expand description
A view into a vacant entry in a HashSet.
It is part of the Entry enum.
§Examples
use rune::alloc::hash_set::{Entry, HashSet, VacantEntry};
let mut set = HashSet::<&str>::new();
let entry_v: VacantEntry<_, _> = match set.entry("a") {
Entry::Vacant(view) => view,
Entry::Occupied(_) => unreachable!(),
};
entry_v.try_insert()?;
assert!(set.contains("a") && set.len() == 1);
// Nonexistent key (try_insert)
match set.entry("b") {
Entry::Vacant(view) => view.try_insert()?,
Entry::Occupied(_) => unreachable!(),
}
assert!(set.contains("b") && set.len() == 2);Auto Trait Implementations§
impl<'a, T, S, A> Freeze for VacantEntry<'a, T, S, A>where
T: Freeze,
impl<'a, T, S, A> RefUnwindSafe for VacantEntry<'a, T, S, A>
impl<'a, T, S, A> Send for VacantEntry<'a, T, S, A>
impl<'a, T, S, A> Sync for VacantEntry<'a, T, S, A>
impl<'a, T, S, A> Unpin for VacantEntry<'a, T, S, A>where
T: Unpin,
impl<'a, T, S, A = Global> !UnwindSafe for VacantEntry<'a, T, S, A>
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