use crate::depot::queue::{indexed::slab, links, tagged};
unsafe impl<T, Tag, const MAX: u32, const N: usize, C: crate::depot::raw::Count>
crate::depot::raw::TagStore for slab::Slab<T, Tag, MAX, tagged::raw::Hook, N, C>
{
type Head = links::raw::Chain;
type Heads = [links::raw::Chain; N];
fn heads(&self) -> &Self::Heads {
self.block.heads()
}
fn is_node(&self, word: u32) -> bool {
(word as usize) < self.block.capacity()
}
unsafe fn hook(&self, index: links::Index) -> &tagged::raw::Hook {
&unsafe { self.block.metadata.add(index.get()).as_ref() }.hook
}
}
unsafe impl<
'a,
T,
Tag,
const MAX: u32,
H: crate::depot::raw::IndexedHook,
const N: usize,
C: crate::depot::raw::Count,
> crate::depot::raw::Project<links::Index, H> for &'a mut slab::Slab<T, Tag, MAX, H, N, C>
{
type Output = slab::raw::Slot<'a, T, Tag, MAX, H, N, C>;
unsafe fn project(self, index: links::Index) -> Self::Output {
slab::raw::Slot { core: self, index }
}
}
unsafe impl<
'a,
T,
Tag,
const MAX: u32,
H: crate::depot::raw::IndexedHook,
const N: usize,
C: crate::depot::raw::Count,
> crate::depot::raw::Project<links::Index, H> for &'a slab::Slab<T, Tag, MAX, H, N, C>
{
type Output = &'a T;
unsafe fn project(self, index: links::Index) -> Self::Output {
unsafe { (&*self.block.value(index)).assume_init_ref() }
}
}