1 macro_rules! os_required {
2     () => {
3         panic!("mio must be compiled with `os-poll` to run.")
4     };
5 }
6 
7 mod selector;
8 pub(crate) use self::selector::{event, Event, Events, Selector};
9 
10 mod waker;
11 pub(crate) use self::waker::Waker;
12 
13 cfg_net! {
14     pub(crate) mod tcp;
15     pub(crate) mod udp;
16     #[cfg(unix)]
17     pub(crate) mod uds;
18 }
19 
20 cfg_io_source! {
21     use std::io;
22     #[cfg(windows)]
23     use std::os::windows::io::RawSocket;
24 
25     #[cfg(windows)]
26     use crate::{Registry, Token, Interest};
27 
28     pub(crate) struct IoSourceState;
29 
30     impl IoSourceState {
31         pub fn new() -> IoSourceState {
32             IoSourceState
33         }
34 
35         pub fn do_io<T, F, R>(&self, f: F, io: &T) -> io::Result<R>
36         where
37             F: FnOnce(&T) -> io::Result<R>,
38         {
39             // We don't hold state, so we can just call the function and
40             // return.
41             f(io)
42         }
43     }
44 
45     #[cfg(windows)]
46     impl IoSourceState {
47          pub fn register(
48             &mut self,
49             _: &Registry,
50             _: Token,
51             _: Interest,
52             _: RawSocket,
53         ) -> io::Result<()> {
54             os_required!()
55         }
56 
57         pub fn reregister(
58             &mut self,
59             _: &Registry,
60             _: Token,
61             _: Interest,
62         ) -> io::Result<()> {
63            os_required!()
64         }
65 
66         pub fn deregister(&mut self) -> io::Result<()> {
67             os_required!()
68         }
69     }
70 }
71