dope-core 0.75.0

Owned native I/O and completion driver for dope
Documentation
use o3::depot::arena::slab::external::{OccupiedSlot, WithdrawnSlot};

use crate::driver::{
    route,
    route::table::{self, PARTITIONS},
};

#[repr(transparent)]
pub struct Entry<'a, T, Tag: route::Tag>(
    pub(in crate::driver::route::table) OccupiedSlot<'a, T, route::Epoch, Tag, PARTITIONS>,
);

impl<'a, T, Tag: route::Tag> Entry<'a, T, Tag> {
    pub fn key(&self) -> table::Key<Tag> {
        table::Key::new(self.0.key())
    }

    pub fn index(&self) -> u32 {
        self.0.key().index()
    }

    pub fn is_full(&self) -> bool {
        self.0.is_full()
    }

    pub fn get(&self) -> &T {
        self.0.get()
    }

    pub fn get_mut(&mut self) -> &mut T {
        self.0.get_mut()
    }

    pub fn into_mut(self) -> &'a mut T {
        self.0.into_mut()
    }

    pub fn remove(self) -> T {
        self.0.remove()
    }

    pub fn retire(self) -> WithdrawnSlot<'a, T, route::Epoch, Tag, PARTITIONS> {
        self.0.retire()
    }

    /// Destroys the occupied value in place before returning its exact slot.
    pub fn discard(self) {
        self.0.discard();
    }

}