1use o3::buffer;
2
3use crate::{
4 io,
5 io::reactor::{complete, ready::delivery},
6 memory::{self, buffer::Recycle},
7};
8
9pub mod admit;
10mod cancel;
11mod install;
12pub mod life;
13pub mod raw;
14pub mod register;
15pub mod ring;
16pub mod shutdown;
17pub use cancel::Cancel;
18pub use install::Install;
19
20pub trait Buffer {
22 type Layout: memory::raw::Layout;
23 type Token: Recycle;
24 type Context: memory::Context<Layout = Self::Layout> + buffer::raw::Fixed<Self::Token>;
25 type Selection: Copy + Eq;
26}
27
28pub trait Source<C> {
30 type Map: complete::Map;
31 type Backend: io::Close<State = Self::Closing> + shutdown::Shutdown;
32 type Closing: io::Retry;
33}
34
35pub trait Complete {
37 type Map: complete::Map;
38 type Pending: Recycle;
39
40 fn next(&mut self) -> Option<Option<<Self::Map as complete::Map>::Entry<Self::Pending>>>;
43}
44
45pub trait Dispatch<'a, C, H>: Source<C>
47where
48 C: delivery::Context<H, Backend = Self::Backend>,
49 H: 'a,
50{
51 type Turn<Q: delivery::Quota<H>>: raw::Dispatch<'a, C, H, Q>;
52}
53
54pub trait Storage<C, P: Copy, R: Copy>: Removal {
56 type Cleanup: memory::Cleanup<P>;
57 type Release: memory::Cleanup<(R, Self::Slot)>;
58}
59
60pub trait Removal {
62 type Slot: Copy + Eq;
63}