o3 0.60.0

shared-nothing primitives
Documentation
use std::marker;

pub struct Slot<B, Tag = (), const ROOT: bool = true, State = ()> {
    pub(in crate::depot::arena::slab) entry: B,
    tag: marker::PhantomData<fn() -> Tag>,
    state: State,
}

impl<B, Tag, const ROOT: bool, State> Slot<B, Tag, ROOT, State> {
    pub(super) fn from_parts(entry: B, state: State) -> Self {
        Self {
            entry,
            state,
            tag: marker::PhantomData,
        }
    }
}

impl<B, Tag, const ROOT: bool> Slot<B, Tag, ROOT> {
    pub(in crate::depot) fn into_inner(self) -> B {
        self.entry
    }

    pub(super) fn new(entry: B) -> Self {
        Self::from_parts(entry, ())
    }

    pub(super) fn with_state<State>(self, state: State) -> Slot<B, Tag, ROOT, State> {
        Slot::from_parts(self.entry, state)
    }
}

pub struct Pinned(());
pub struct Logical;

impl<B, Tag> Slot<B, Tag, true, Pinned> {
    /// # Safety
    /// The entry's original exclusive store loan is pinned for its entire lifetime.
    pub(in crate::depot) unsafe fn pinned(entry: B) -> Self {
        Self::from_parts(entry, Pinned(()))
    }
}

pub(super) mod anchor;
pub(super) mod anchored;
pub(super) mod occupied;
pub(super) mod staged;