use o3::buffer;
use crate::{
io,
io::reactor::{complete, ready::delivery},
memory::{self, buffer::Recycle},
};
pub mod admit;
mod cancel;
mod install;
pub mod life;
pub mod raw;
pub mod register;
pub mod ring;
pub mod shutdown;
pub use cancel::Cancel;
pub use install::Install;
pub trait Buffer {
type Layout: memory::raw::Layout;
type Token: Recycle;
type Context: memory::Context<Layout = Self::Layout> + buffer::raw::Fixed<Self::Token>;
type Selection: Copy + Eq;
}
pub trait Source<C> {
type Map: complete::Map;
type Backend: io::Close<State = Self::Closing> + shutdown::Shutdown;
type Closing: io::Retry;
}
pub trait Complete {
type Map: complete::Map;
type Pending: Recycle;
fn next(&mut self) -> Option<Option<<Self::Map as complete::Map>::Entry<Self::Pending>>>;
}
pub trait Dispatch<'a, C, H>: Source<C>
where
C: delivery::Context<H, Backend = Self::Backend>,
H: 'a,
{
type Turn<Q: delivery::Quota<H>>: raw::Dispatch<'a, C, H, Q>;
}
pub trait Storage<C, P: Copy, R: Copy>: Removal {
type Cleanup: memory::Cleanup<P>;
type Release: memory::Cleanup<(R, Self::Slot)>;
}
pub trait Removal {
type Slot: Copy + Eq;
}