use crate::depot::{heap, index::Position};
#[repr(transparent)]
pub struct Removed<'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>, heap::Stored<K, P>>,
}
use heap::resident;
impl<K: crate::depot::raw::Address, P: Ord, R: Copy, I: Position>
resident::Removed<'_, K, P, R, I>
{
pub fn key(&self) -> K {
self.entry.value.identity
}
pub const fn priority(&self) -> &P {
&self.entry.value.priority
}
pub fn resident(&self) -> &R {
unsafe { heap::raw::resident(self.entry.owner, self.entry.value.identity) }
}
pub fn resident_mut(&mut self) -> &mut R {
unsafe { heap::raw::resident_mut(self.entry.owner, self.entry.value.identity) }
}
pub fn reinsert(self, priority: P) {
heap::Vacancy {
owner: self.entry.owner,
value: self.entry.value.identity,
}
.prepare(priority)
.store();
}
}