use crate::depot::queue::links;
pub(in crate::depot) unsafe trait Removal<'a, C: crate::depot::raw::ChainCount>:
Sized
{
fn links(&self) -> &'a links::Chain<C>;
unsafe fn apply(self) -> links::Detached<'a>;
fn commit(self) -> links::Detached<'a>
where
C: 'a,
{
let count = C::storage((unsafe { self.links().parts() }).2);
let next = count.map(|count| count.get() - 1);
let vacant = unsafe { self.apply() };
if let Some((count, next)) = count.zip(next) {
count.set(next);
}
vacant
}
}