o3 0.62.0

shared-nothing primitives
Documentation
use crate::depot::queue::links;
/// Proof that one exact hook is detached from every topology.
pub struct Detached<'a> {
    hook: &'a links::Hook,
    index: links::Index,
}

impl Detached<'_> {
    /// The compact identity of this retained detached hook.
    pub const fn index(&self) -> links::Index {
        self.index
    }

    pub fn idle(self) {
        self.hook.previous.set(self.index.raw());
        self.hook.next.set(links::Index::END);
    }

    pub fn park(self) {
        self.hook.previous.set(self.index.raw());
        self.hook.next.set(self.index.raw());
    }
}
impl<'a> Detached<'a> {
    pub fn from_source(
        proof: crate::depot::raw::Proof<(&'a links::Hook, links::Index), links::Vacant>,
    ) -> Self {
        let (hook, index) = proof.into_inner();
        Self { hook, index }
    }

    /// # Safety
    /// The exact hook is exclusively detached at this index with no other live capability.
    pub(in crate::depot) unsafe fn new(hook: &'a links::Hook, index: links::Index) -> Self {
        Self { hook, index }
    }

    pub(in crate::depot) fn into_parts(self) -> (&'a links::Hook, links::Index) {
        (self.hook, self.index)
    }
}