1pub mod fd;
2pub mod file;
3pub mod pipe;
4pub mod poll;
5pub mod socket;
6use std::convert;
7
8use o3::mem::Rejected;
9
10pub mod raw;
11pub mod reactor;
12pub mod request;
13
14pub trait Close: Sized {
16 type State: Retry;
17
18 fn try_close(self) -> Result<(), Self::State>;
19}
20
21pub trait Retry: Sized {
23 type Failure;
24 type Owner: Close<State = Self>;
25
26 fn recover(self) -> Rejected<Self::Owner, Self::Failure>;
27}
28
29pub enum Cleanup<O, S> {
31 Owner(O),
32 Storage(S),
33}
34
35impl Retry for convert::Infallible {
36 type Failure = Self;
37 type Owner = Self;
38
39 fn recover(self) -> Rejected<Self::Owner, Self::Failure> {
40 match self {}
41 }
42}
43
44impl Close for convert::Infallible {
45 type State = Self;
46
47 fn try_close(self) -> Result<(), Self::State> {
48 match self {}
49 }
50}
51
52impl<O, E> Retry for Rejected<O, E>
53where
54 O: Close<State = Self>,
55{
56 type Failure = E;
57 type Owner = O;
58
59 fn recover(self) -> Rejected<O, E> {
60 self
61 }
62}