tcp: Update listener docs (#2276)

* Update listener docs
* re-wrap text and add links
This commit is contained in:
Akshay Narayan
2020-02-26 21:16:13 +01:00
committed by GitHub
parent 8b7ea0ff5c
commit d44ce338af
2 changed files with 13 additions and 9 deletions
+7 -5
View File
@@ -12,10 +12,10 @@ use std::task::{Context, Poll};
cfg_tcp! { cfg_tcp! {
/// A TCP socket server, listening for connections. /// A TCP socket server, listening for connections.
/// ///
/// Also implements a stream over the connections being received on this listener. /// You can accept a new connection by using the [`accept`](`TcpListener::accept`) method. Alternatively `TcpListener`
/// /// implements the [`Stream`](`crate::stream::Stream`) trait, which allows you to use the listener in places that want a
/// The stream will never return `None` and will also not yield the peer's /// stream. The stream will never return `None` and will also not yield the peer's `SocketAddr` structure. Iterating over
/// `SocketAddr` structure. Iterating over it is equivalent to calling accept in a loop. /// it is equivalent to calling accept in a loop.
/// ///
/// # Errors /// # Errors
/// ///
@@ -27,7 +27,7 @@ cfg_tcp! {
/// ///
/// # Examples /// # Examples
/// ///
/// Using [`TcpListener::accept`]: /// Using `accept`:
/// ```no_run /// ```no_run
/// use tokio::net::TcpListener; /// use tokio::net::TcpListener;
/// ///
@@ -278,6 +278,8 @@ impl TcpListener {
/// Returns a stream over the connections being received on this listener. /// Returns a stream over the connections being received on this listener.
/// ///
/// Note that `TcpListener` also directly implements `Stream`.
///
/// The returned stream will never return `None` and will also not yield the /// The returned stream will never return `None` and will also not yield the
/// peer's `SocketAddr` structure. Iterating over it is equivalent to /// peer's `SocketAddr` structure. Iterating over it is equivalent to
/// calling accept in a loop. /// calling accept in a loop.
+6 -4
View File
@@ -15,10 +15,10 @@ use std::task::{Context, Poll};
cfg_uds! { cfg_uds! {
/// A Unix socket which can accept connections from other Unix sockets. /// A Unix socket which can accept connections from other Unix sockets.
/// ///
/// Also implements a stream over the connections being received on this listener. /// You can accept a new connection by using the [`accept`](`UnixListener::accept`) method. Alternatively `UnixListener`
/// /// implements the [`Stream`](`crate::stream::Stream`) trait, which allows you to use the listener in places that want a
/// The stream will never return `None` and will also not yield the peer's /// stream. The stream will never return `None` and will also not yield the peer's `SocketAddr` structure. Iterating over
/// `SocketAddr` structure. Iterating over it is equivalent to calling accept in a loop. /// it is equivalent to calling accept in a loop.
/// ///
/// # Errors /// # Errors
/// ///
@@ -137,6 +137,8 @@ impl UnixListener {
/// Returns a stream over the connections being received on this listener. /// Returns a stream over the connections being received on this listener.
/// ///
/// Note that `UnixListener` also directly implements `Stream`.
///
/// The returned stream will never return `None` and will also not yield the /// The returned stream will never return `None` and will also not yield the
/// peer's `SocketAddr` structure. Iterating over it is equivalent to /// peer's `SocketAddr` structure. Iterating over it is equivalent to
/// calling accept in a loop. /// calling accept in a loop.