1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
//! TCP/UDP/Unix bindings for `tokio`. //! //! This module contains the TCP/UDP/Unix networking types, similar to the standard //! library, which can be used to implement networking protocols. //! //! # Organization //! //! * [`TcpListener`] and [`TcpStream`] provide functionality for communication over TCP //! * [`UdpSocket`] and [`UdpFramed`] provide functionality for communication over UDP //! * [`UnixListener`] and [`UnixStream`] provide functionality for communication over a //! Unix Domain Stream Socket **(available on Unix only)** //! * [`UnixDatagram`] and [`UnixDatagramFramed`] provide functionality for communication //! over Unix Domain Datagram Socket **(available on Unix only)** //! //! [`TcpListener`]: struct.TcpListener.html //! [`TcpStream`]: struct.TcpStream.html //! [`UdpSocket`]: struct.UdpSocket.html //! [`UdpFramed`]: struct.UdpFramed.html //! [`UnixListener`]: struct.UnixListener.html //! [`UnixStream`]: struct.UnixStream.html //! [`UnixDatagram`]: struct.UnixDatagram.html //! [`UnixDatagramFramed`]: struct.UnixDatagramFramed.html #[cfg(feature = "tcp")] pub mod tcp { //! TCP bindings for `tokio`. //! //! Connecting to an address, via TCP, can be done using [`TcpStream`]'s //! [`connect`] method, which returns [`ConnectFuture`]. `ConnectFuture` //! implements a future which returns a `TcpStream`. //! //! To listen on an address [`TcpListener`] can be used. `TcpListener`'s //! [`incoming`][incoming_method] method can be used to accept new connections. //! It return the [`Incoming`] struct, which implements a stream which returns //! `TcpStream`s. //! //! [`TcpStream`]: struct.TcpStream.html //! [`connect`]: struct.TcpStream.html#method.connect //! [`ConnectFuture`]: struct.ConnectFuture.html //! [`TcpListener`]: struct.TcpListener.html //! [incoming_method]: struct.TcpListener.html#method.incoming //! [`Incoming`]: struct.Incoming.html pub use tokio_tcp::{ConnectFuture, Incoming, TcpListener, TcpStream}; } #[cfg(feature = "tcp")] pub use self::tcp::{TcpListener, TcpStream}; #[cfg(feature = "tcp")] #[deprecated(note = "use `tokio::net::tcp::ConnectFuture` instead")] #[doc(hidden)] pub type ConnectFuture = self::tcp::ConnectFuture; #[cfg(feature = "tcp")] #[deprecated(note = "use `tokio::net::tcp::Incoming` instead")] #[doc(hidden)] pub type Incoming = self::tcp::Incoming; #[cfg(feature = "udp")] pub mod udp { //! UDP bindings for `tokio`. //! //! The main struct for UDP is the [`UdpSocket`], which represents a UDP socket. //! Reading and writing to it can be done using futures, which return the //! [`RecvDgram`] and [`SendDgram`] structs respectively. //! //! For convenience it's also possible to convert raw datagrams into higher-level //! frames. //! //! [`UdpSocket`]: struct.UdpSocket.html //! [`RecvDgram`]: struct.RecvDgram.html //! [`SendDgram`]: struct.SendDgram.html //! [`UdpFramed`]: struct.UdpFramed.html //! [`framed`]: struct.UdpSocket.html#method.framed pub use tokio_udp::{RecvDgram, SendDgram, UdpFramed, UdpSocket}; } #[cfg(feature = "udp")] pub use self::udp::{UdpFramed, UdpSocket}; #[cfg(feature = "udp")] #[deprecated(note = "use `tokio::net::udp::RecvDgram` instead")] #[doc(hidden)] pub type RecvDgram<T> = self::udp::RecvDgram<T>; #[cfg(feature = "udp")] #[deprecated(note = "use `tokio::net::udp::SendDgram` instead")] #[doc(hidden)] pub type SendDgram<T> = self::udp::SendDgram<T>; #[cfg(all(unix, feature = "uds"))] pub mod unix { //! Unix domain socket bindings for `tokio` (only available on unix systems). pub use tokio_uds::{ ConnectFuture, Incoming, RecvDgram, SendDgram, UCred, UnixDatagram, UnixDatagramFramed, UnixListener, UnixStream, }; } #[cfg(all(unix, feature = "uds"))] pub use self::unix::{UnixDatagram, UnixDatagramFramed, UnixListener, UnixStream};