dope-sys 0.76.0

Typed operating-system call contracts
Documentation
use crate::{
    io::reactor::event::kind,
    table::{reclaim, token::host::Flight},
};

/// Descriptor admission and retirement remain in their original domain.
pub trait Slots<F: Flight> {
    type Index: Copy;
    type Capacity: Copy;
    type Physical: Copy + Eq;
    type Outbound: Copy + Into<Self::Physical>;
    type Creation: AsRef<Self::Outbound>;
    type Accepted: TryFrom<(Self::Index, Self::Capacity), Error = (Self::Index, Self::Capacity)>;
    type Reclaimed;
    type Retirement: reclaim::Queue<Slot = Self::Physical>;

    fn accept_cap(&self) -> Self::Capacity;
    fn creation(&self, target: F::Target<kind::Socket>) -> Option<Self::Creation>;
    fn fail_create(&self, creation: Self::Creation);
    fn created(&self, creation: Self::Creation) -> Result<F::Created, F::SocketFailure>;
    fn accepted(&self, accepted: Self::Accepted) -> Result<F::Descriptor, F::AcceptFailure>;
    fn abandon(&self, accepted: Self::Accepted) -> Self::Reclaimed;
    fn reclaim(&self, creation: Self::Creation);
    fn retirement(&self) -> Self::Retirement;
}