o3 0.62.0

shared-nothing primitives
Documentation
use crate::depot::queue::{indexed::slab, links, tagged};

// SAFETY: Slab retains the initialized metadata allocation and exact N-head domain.
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
    }
}

// SAFETY: the live proof transfers the original exclusive owner and initialized slot unchanged.
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 }
    }
}

// SAFETY: the initialized payload retains the complete source borrow's lifetime.
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() }
    }
}