docs: update docs for from_std functions (#3016)

Fixes: #3007
This commit is contained in:
Zahari Dichev
2020-10-24 14:26:01 +02:00
committed by GitHub
parent e804f88d60
commit ce173fdc91
6 changed files with 25 additions and 19 deletions
+1 -1
View File
@@ -196,7 +196,7 @@ impl TcpListener {
} }
} }
/// Creates a new TCP listener from the standard library's TCP listener. /// Creates new `TcpListener` from a `std::net::TcpListener`.
/// ///
/// This function is intended to be used to wrap a TCP listener from the /// This function is intended to be used to wrap a TCP listener from the
/// standard library in the Tokio equivalent. The conversion assumes nothing /// standard library in the Tokio equivalent. The conversion assumes nothing
+4 -2
View File
@@ -145,8 +145,10 @@ impl TcpStream {
/// Creates new `TcpStream` from a `std::net::TcpStream`. /// Creates new `TcpStream` from a `std::net::TcpStream`.
/// ///
/// This function will convert a TCP stream created by the standard library /// This function is intended to be used to wrap a TCP stream from the
/// to a TCP stream ready to be used with the provided event loop handle. /// standard library in the Tokio equivalent. The conversion assumes nothing
/// about the underlying stream; it is left up to the user to set it in
/// non-blocking mode.
/// ///
/// # Examples /// # Examples
/// ///
+5 -4
View File
@@ -158,11 +158,12 @@ impl UdpSocket {
Ok(UdpSocket { io }) Ok(UdpSocket { io })
} }
/// Creates a new `UdpSocket` from the previously bound socket provided. /// Creates new `UdpSocket` from a previously bound `std::net::UdpSocket`.
/// ///
/// The socket given will be registered with the event loop that `handle` /// This function is intended to be used to wrap a UDP socket from the
/// is associated with. This function requires that `socket` has previously /// standard library in the Tokio equivalent. The conversion assumes nothing
/// been bound to an address to work correctly. /// about the underlying socket; it is left up to the user to set it in
/// non-blocking mode.
/// ///
/// This can be used in conjunction with net2's `UdpBuilder` interface to /// This can be used in conjunction with net2's `UdpBuilder` interface to
/// configure a socket before it's handed off, such as setting options like /// configure a socket before it's handed off, such as setting options like
+5 -4
View File
@@ -149,11 +149,12 @@ impl UnixDatagram {
Ok((a, b)) Ok((a, b))
} }
/// Consumes a `UnixDatagram` in the standard library and returns a /// Creates new `UnixDatagram` from a `std::os::unix::net::UnixDatagram`.
/// nonblocking `UnixDatagram` from this crate.
/// ///
/// The returned datagram will be associated with the given event loop /// This function is intended to be used to wrap a UnixDatagram from the
/// specified by `handle` and is ready to perform I/O. /// standard library in the Tokio equivalent. The conversion assumes
/// nothing about the underlying datagram; it is left up to the user to set
/// it in non-blocking mode.
/// ///
/// # Panics /// # Panics
/// ///
+5 -4
View File
@@ -68,11 +68,12 @@ impl UnixListener {
Ok(UnixListener { io }) Ok(UnixListener { io })
} }
/// Consumes a `UnixListener` in the standard library and returns a /// Creates new `UnixListener` from a `std::os::unix::net::UnixListener `.
/// nonblocking `UnixListener` from this crate.
/// ///
/// The returned listener will be associated with the given event loop /// This function is intended to be used to wrap a UnixListener from the
/// specified by `handle` and is ready to perform I/O. /// standard library in the Tokio equivalent. The conversion assumes
/// nothing about the underlying listener; it is left up to the user to set
/// it in non-blocking mode.
/// ///
/// # Panics /// # Panics
/// ///
+5 -4
View File
@@ -43,11 +43,12 @@ impl UnixStream {
Ok(stream) Ok(stream)
} }
/// Consumes a `UnixStream` in the standard library and returns a /// Creates new `UnixStream` from a `std::os::unix::net::UnixStream`.
/// nonblocking `UnixStream` from this crate.
/// ///
/// The returned stream will be associated with the given event loop /// This function is intended to be used to wrap a UnixStream from the
/// specified by `handle` and is ready to perform I/O. /// standard library in the Tokio equivalent. The conversion assumes
/// nothing about the underlying stream; it is left up to the user to set
/// it in non-blocking mode.
/// ///
/// # Panics /// # Panics
/// ///