Skip to main content

dope_sys/table/
slots.rs

1use crate::{
2    io::reactor::event::kind,
3    table::{reclaim, token::host::Flight},
4};
5
6/// Descriptor admission and retirement remain in their original domain.
7pub trait Slots<F: Flight> {
8    type Index: Copy;
9    type Capacity: Copy;
10    type Physical: Copy + Eq;
11    type Outbound: Copy + Into<Self::Physical>;
12    type Creation: AsRef<Self::Outbound>;
13    type Accepted: TryFrom<(Self::Index, Self::Capacity), Error = (Self::Index, Self::Capacity)>;
14    type Reclaimed;
15    type Retirement: reclaim::Queue<Slot = Self::Physical>;
16
17    fn accept_cap(&self) -> Self::Capacity;
18    fn creation(&self, target: F::Target<kind::Socket>) -> Option<Self::Creation>;
19    fn fail_create(&self, creation: Self::Creation);
20    fn created(&self, creation: Self::Creation) -> Result<F::Created, F::SocketFailure>;
21    fn accepted(&self, accepted: Self::Accepted) -> Result<F::Descriptor, F::AcceptFailure>;
22    fn abandon(&self, accepted: Self::Accepted) -> Self::Reclaimed;
23    fn reclaim(&self, creation: Self::Creation);
24    fn retirement(&self) -> Self::Retirement;
25}