1 | #![cfg (not(loom))] |
2 | |
3 | //! TCP/UDP/Unix bindings for `tokio`. |
4 | //! |
5 | //! This module contains the TCP/UDP/Unix networking types, similar to the standard |
6 | //! library, which can be used to implement networking protocols. |
7 | //! |
8 | //! # Organization |
9 | //! |
10 | //! * [`TcpListener`] and [`TcpStream`] provide functionality for communication over TCP |
11 | //! * [`UdpSocket`] provides functionality for communication over UDP |
12 | //! * [`UnixListener`] and [`UnixStream`] provide functionality for communication over a |
13 | //! Unix Domain Stream Socket **(available on Unix only)** |
14 | //! * [`UnixDatagram`] provides functionality for communication |
15 | //! over Unix Domain Datagram Socket **(available on Unix only)** |
16 | |
17 | //! |
18 | //! [`TcpListener`]: TcpListener |
19 | //! [`TcpStream`]: TcpStream |
20 | //! [`UdpSocket`]: UdpSocket |
21 | //! [`UnixListener`]: UnixListener |
22 | //! [`UnixStream`]: UnixStream |
23 | //! [`UnixDatagram`]: UnixDatagram |
24 | |
25 | mod addr; |
26 | cfg_not_wasi! { |
27 | #[cfg (feature = "net" )] |
28 | pub(crate) use addr::to_socket_addrs; |
29 | } |
30 | pub use addr::ToSocketAddrs; |
31 | |
32 | cfg_net! { |
33 | mod lookup_host; |
34 | pub use lookup_host::lookup_host; |
35 | |
36 | pub mod tcp; |
37 | pub use tcp::listener::TcpListener; |
38 | pub use tcp::stream::TcpStream; |
39 | cfg_not_wasi! { |
40 | pub use tcp::socket::TcpSocket; |
41 | |
42 | mod udp; |
43 | pub use udp::UdpSocket; |
44 | } |
45 | } |
46 | |
47 | cfg_net_unix! { |
48 | pub mod unix; |
49 | pub use unix::datagram::socket::UnixDatagram; |
50 | pub use unix::listener::UnixListener; |
51 | pub use unix::stream::UnixStream; |
52 | pub use unix::socket::UnixSocket; |
53 | } |
54 | |
55 | cfg_net_windows! { |
56 | pub mod windows; |
57 | } |
58 | |