use crate::{
base::num::bounded,
depot::{
arena::hash::{self, runtime::entry},
map,
queue::links,
},
};
use std::mem;
pub struct Vacancy<'a, T, Tag> {
pub(in crate::depot::arena::hash) core: &'a mut hash::raw::Core<T, Tag>,
pub(in crate::depot::arena::hash) index: bounded::raw::U32<0, { u32::MAX - 1 }>,
pub(in crate::depot::arena::hash) bucket: map::raw::Vacant,
pub(in crate::depot::arena::hash) hash: u64,
}
const _: () = {
assert!(mem::size_of::<Vacancy<'static, (), ()>>() == mem::size_of::<(&(), u64, u32, u32)>());
assert!(
mem::size_of::<Option<Vacancy<'static, (), ()>>>()
== mem::size_of::<Vacancy<'static, (), ()>>()
);
};
impl<'a, T, Tag> Vacancy<'a, T, Tag> {
pub fn index(&self) -> links::Index {
self.index.into()
}
pub fn insert(self, value: T) -> entry::Live<'a, T, Tag, entry::Occupied> {
hash::raw::insert(self, value)
}
}