1mod tcp_listener;
4mod tcp_stream;
5mod to_socket_addrs;
6mod udp_socket;
7
8pub use tcp_listener::*;
9pub use tcp_stream::*;
10pub use to_socket_addrs::*;
11pub use udp_socket::*;
12
13use cfg_if::cfg_if;
14
15cfg_if! {
16 if #[cfg(windows)] {
17 pub trait OsSocket: std::os::windows::io::AsRawSocket + std::os::windows::io::AsSocket + From<std::os::windows::io::OwnedSocket> {}
19 impl<T> OsSocket for T where T: std::os::windows::io::AsRawSocket + std::os::windows::io::AsSocket {}
20 } else if #[cfg(any(unix, target_os = "wasi"))]{
21 pub trait OsSocket: std::os::fd::AsRawFd + std::os::fd::AsFd + From<std::os::fd::OwnedFd> {}
23 impl<T> OsSocket for T where T: std::os::fd::AsRawFd + std::os::fd::AsFd + From<std::os::fd::OwnedFd> {}
24 } else {
25 pub trait OsSocket {}
27 impl<T> OsSocket for T {}
28 }
29}
30
31pub trait NetRuntime: Send + Sync {
33 type TcpListener: RuntimeTcpListener<Runtime = Self>;
35 type TcpStream: RuntimeTcpStream<Runtime = Self>;
37 type UdpSocket: RuntimeUdpSocket<Runtime = Self>;
39}