summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZahari Dichev <zaharidichev@gmail.com>2020-10-24 15:26:01 +0300
committerGitHub <noreply@github.com>2020-10-24 14:26:01 +0200
commitce173fdc918c5934561560a97d366fce6edb36d0 (patch)
treeb02982334d44d76b405441b4c95c1fe6e7deb830
parente804f88d60071f0d89db85aaa4a073857904b545 (diff)
docs: update docs for `from_std` functions (#3016)
Fixes: #3007
-rw-r--r--tokio/src/net/tcp/listener.rs2
-rw-r--r--tokio/src/net/tcp/stream.rs6
-rw-r--r--tokio/src/net/udp/socket.rs9
-rw-r--r--tokio/src/net/unix/datagram/socket.rs9
-rw-r--r--tokio/src/net/unix/listener.rs9
-rw-r--r--tokio/src/net/unix/stream.rs9
6 files changed, 25 insertions, 19 deletions
diff --git a/tokio/src/net/tcp/listener.rs b/tokio/src/net/tcp/listener.rs
index ab3bc7de..50130a28 100644
--- a/tokio/src/net/tcp/listener.rs
+++ b/tokio/src/net/tcp/listener.rs
@@ -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
/// standard library in the Tokio equivalent. The conversion assumes nothing
diff --git a/tokio/src/net/tcp/stream.rs b/tokio/src/net/tcp/stream.rs
index f90e9a39..204a1940 100644
--- a/tokio/src/net/tcp/stream.rs
+++ b/tokio/src/net/tcp/stream.rs
@@ -145,8 +145,10 @@ impl TcpStream {
/// Creates new `TcpStream` from a `std::net::TcpStream`.
///
- /// This function will convert a TCP stream created by the standard library
- /// to a TCP stream ready to be used with the provided event loop handle.
+ /// This function is intended to be used to wrap a TCP stream from the
+ /// 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
///
diff --git a/tokio/src/net/udp/socket.rs b/tokio/src/net/udp/socket.rs
index beb2252c..55f26110 100644
--- a/tokio/src/net/udp/socket.rs
+++ b/tokio/src/net/udp/socket.rs
@@ -158,11 +158,12 @@ impl UdpSocket {
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`
- /// is associated with. This function requires that `socket` has previously
- /// been bound to an address to work correctly.
+ /// This function is intended to be used to wrap a UDP socket from the
+ /// standard library in the Tokio equivalent. The conversion assumes nothing
+ /// 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
/// configure a socket before it's handed off, such as setting options like
diff --git a/tokio/src/net/unix/datagram/socket.rs b/tokio/src/net/unix/datagram/socket.rs
index 3ae66d1f..051c0d1e 100644
--- a/tokio/src/net/unix/datagram/socket.rs
+++ b/tokio/src/net/unix/datagram/socket.rs
@@ -149,11 +149,12 @@ impl UnixDatagram {
Ok((a, b))
}
- /// Consumes a `UnixDatagram` in the standard library and returns a
- /// nonblocking `UnixDatagram` from this crate.
+ /// Creates new `UnixDatagram` from a `std::os::unix::net::UnixDatagram`.
///
- /// The returned datagram will be associated with the given event loop
- /// specified by `handle` and is ready to perform I/O.
+ /// This function is intended to be used to wrap a UnixDatagram from the
+ /// 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
///
diff --git a/tokio/src/net/unix/listener.rs b/tokio/src/net/unix/listener.rs
index 4e0d9ede..8f0d4c0b 100644
--- a/tokio/src/net/unix/listener.rs
+++ b/tokio/src/net/unix/listener.rs
@@ -68,11 +68,12 @@ impl UnixListener {
Ok(UnixListener { io })
}
- /// Consumes a `UnixListener` in the standard library and returns a
- /// nonblocking `UnixListener` from this crate.
+ /// Creates new `UnixListener` from a `std::os::unix::net::UnixListener `.
///
- /// The returned listener will be associated with the given event loop
- /// specified by `handle` and is ready to perform I/O.
+ /// This function is intended to be used to wrap a UnixListener from the
+ /// 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
///
diff --git a/tokio/src/net/unix/stream.rs b/tokio/src/net/unix/stream.rs
index 5138077b..2f3dd128 100644
--- a/tokio/src/net/unix/stream.rs
+++ b/tokio/src/net/unix/stream.rs
@@ -43,11 +43,12 @@ impl UnixStream {
Ok(stream)
}
- /// Consumes a `UnixStream` in the standard library and returns a
- /// nonblocking `UnixStream` from this crate.
+ /// Creates new `UnixStream` from a `std::os::unix::net::UnixStream`.
///
- /// The returned stream will be associated with the given event loop
- /// specified by `handle` and is ready to perform I/O.
+ /// This function is intended to be used to wrap a UnixStream from the
+ /// 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
///