use crate::depot::{heap, index::Position};
#[repr(transparent)]
pub struct Vacant<'a, K: crate::depot::raw::Address, P: Ord, R: Copy, I: Position = u32> {
pub(in crate::depot::heap) entry: heap::Vacancy<&'a mut resident::Min<K, P, R, I>, K>,
}
use heap::resident;
impl<K: crate::depot::raw::Address, P: Ord, R: Copy, I: Position> resident::Vacant<'_, K, P, R, I> {
pub fn key(&self) -> K {
self.entry.value
}
pub fn resident(&self) -> &R {
unsafe { heap::raw::resident(self.entry.owner, self.entry.value) }
}
pub fn resident_mut(&mut self) -> &mut R {
unsafe { heap::raw::resident_mut(self.entry.owner, self.entry.value) }
}
pub fn insert(self, priority: P) {
self.entry.prepare(priority).store();
}
}