Skip to main content

dope_sys/table/token/
codec.rs

1use crate::{
2    io::reactor::complete,
3    table::token::{Close, Context, Decoded, Tuning, frame, host},
4};
5
6type Frame<C> = Decoded<
7    <<C as Codec>::Context as host::Context>::Key,
8    <<C as Codec>::Context as host::Context>::Returned,
9    <C as Codec>::Frame,
10    <C as Codec>::Tuning,
11>;
12
13/// Native identity construction and classification, before host ownership binding.
14pub trait Codec: complete::raw::Token {
15    type Context: host::Context;
16    type Close<'d>: Close<'d, Context = Self::Context>;
17    type Tuning: Tuning<Slot = <Self::Context as Context>::Slot>;
18    type Frame: frame::Decode<Context = Self::Context, Tuning = Self::Tuning>;
19
20    fn close(control: Self::Close<'_>) -> Self;
21    fn flight(key: <Self::Context as host::Context>::Key) -> Self;
22    fn prepare() -> Self;
23    fn probe(probe: <Self::Context as host::Context>::Probe) -> Self;
24    fn cancel_probe(probe: <Self::Context as host::Context>::Probe) -> Self;
25    fn shutdown() -> Self;
26    fn tuning(control: Self::Tuning) -> Self;
27    fn cancel_key(key: <Self::Context as host::Context>::Key) -> Self;
28    fn cancel_tune(control: Self::Tuning) -> Self;
29    fn cancel(cancel: host::Cancel<<Self::Context as host::Context>::Key, Self::Tuning>) -> Self;
30    fn closed(self) -> Option<<Self::Context as host::Context>::Returned>;
31    fn decode(self) -> Frame<Self>;
32}