1 | use std::io; |
2 | #[cfg (unix)] |
3 | use std::os::unix::io::{AsRawFd, RawFd}; |
4 | use std::time::Duration; |
5 | |
6 | pub type Event = usize; |
7 | |
8 | pub type Events = Vec<Event>; |
9 | |
10 | #[derive(Debug)] |
11 | pub struct Selector {} |
12 | |
13 | impl Selector { |
14 | pub fn try_clone(&self) -> io::Result<Selector> { |
15 | os_required!(); |
16 | } |
17 | |
18 | pub fn select(&self, _: &mut Events, _: Option<Duration>) -> io::Result<()> { |
19 | os_required!(); |
20 | } |
21 | } |
22 | |
23 | #[cfg (unix)] |
24 | cfg_any_os_ext! { |
25 | use crate::{Interest, Token}; |
26 | |
27 | impl Selector { |
28 | pub fn register(&self, _: RawFd, _: Token, _: Interest) -> io::Result<()> { |
29 | os_required!(); |
30 | } |
31 | |
32 | pub fn reregister(&self, _: RawFd, _: Token, _: Interest) -> io::Result<()> { |
33 | os_required!(); |
34 | } |
35 | |
36 | pub fn deregister(&self, _: RawFd) -> io::Result<()> { |
37 | os_required!(); |
38 | } |
39 | } |
40 | } |
41 | |
42 | #[cfg (target_os = "wasi" )] |
43 | cfg_any_os_ext! { |
44 | use crate::{Interest, Token}; |
45 | |
46 | impl Selector { |
47 | pub fn register(&self, _: wasi::Fd, _: Token, _: Interest) -> io::Result<()> { |
48 | os_required!(); |
49 | } |
50 | |
51 | pub fn reregister(&self, _: wasi::Fd, _: Token, _: Interest) -> io::Result<()> { |
52 | os_required!(); |
53 | } |
54 | |
55 | pub fn deregister(&self, _: wasi::Fd) -> io::Result<()> { |
56 | os_required!(); |
57 | } |
58 | } |
59 | } |
60 | |
61 | cfg_io_source! { |
62 | #[cfg (debug_assertions)] |
63 | impl Selector { |
64 | pub fn id(&self) -> usize { |
65 | os_required!(); |
66 | } |
67 | } |
68 | } |
69 | |
70 | #[cfg (unix)] |
71 | impl AsRawFd for Selector { |
72 | fn as_raw_fd(&self) -> RawFd { |
73 | os_required!() |
74 | } |
75 | } |
76 | |
77 | #[allow (clippy::trivially_copy_pass_by_ref)] |
78 | pub mod event { |
79 | use crate::sys::Event; |
80 | use crate::Token; |
81 | use std::fmt; |
82 | |
83 | pub fn token(_: &Event) -> Token { |
84 | os_required!(); |
85 | } |
86 | |
87 | pub fn is_readable(_: &Event) -> bool { |
88 | os_required!(); |
89 | } |
90 | |
91 | pub fn is_writable(_: &Event) -> bool { |
92 | os_required!(); |
93 | } |
94 | |
95 | pub fn is_error(_: &Event) -> bool { |
96 | os_required!(); |
97 | } |
98 | |
99 | pub fn is_read_closed(_: &Event) -> bool { |
100 | os_required!(); |
101 | } |
102 | |
103 | pub fn is_write_closed(_: &Event) -> bool { |
104 | os_required!(); |
105 | } |
106 | |
107 | pub fn is_priority(_: &Event) -> bool { |
108 | os_required!(); |
109 | } |
110 | |
111 | pub fn is_aio(_: &Event) -> bool { |
112 | os_required!(); |
113 | } |
114 | |
115 | pub fn is_lio(_: &Event) -> bool { |
116 | os_required!(); |
117 | } |
118 | |
119 | pub fn debug_details(_: &mut fmt::Formatter<'_>, _: &Event) -> fmt::Result { |
120 | os_required!(); |
121 | } |
122 | } |
123 | |