summaryrefslogtreecommitdiffstats
path: root/tokio/src/net/tcp/stream.rs
diff options
context:
space:
mode:
authorAlice Ryhl <alice@ryhl.io>2020-07-24 21:56:38 +0200
committerGitHub <noreply@github.com>2020-07-24 12:56:38 -0700
commit4fca1974e9d9f95fab7d723619294cb4b2dcebbb (patch)
treeb44bd16a594adff645d8342656c3cdfcff0c54f3 /tokio/src/net/tcp/stream.rs
parent08872c55d161cac08f4feb3e141883a47ab766cf (diff)
net: ensure that unix sockets have both split and into_split (#2687)
The documentation build failed with errors such as error: `[read]` public documentation for `take` links to a private item --> tokio/src/io/util/async_read_ext.rs:1078:9 | 1078 | / /// Creates an adaptor which reads at most `limit` bytes from it. 1079 | | /// 1080 | | /// This function returns a new instance of `AsyncRead` which will read 1081 | | /// at most `limit` bytes, after which it will always return EOF ... | 1103 | | /// } 1104 | | /// ``` | |_______________^ | note: the lint level is defined here --> tokio/src/lib.rs:13:9 | 13 | #![deny(intra_doc_link_resolution_failure)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: the link appears in this line: bytes read and future calls to [`read()`][read] may succeed.
Diffstat (limited to 'tokio/src/net/tcp/stream.rs')
-rw-r--r--tokio/src/net/tcp/stream.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/tokio/src/net/tcp/stream.rs b/tokio/src/net/tcp/stream.rs
index cc81e116..02b52627 100644
--- a/tokio/src/net/tcp/stream.rs
+++ b/tokio/src/net/tcp/stream.rs
@@ -659,6 +659,9 @@ impl TcpStream {
self.io.get_ref().set_linger(dur)
}
+ // These lifetime markers also appear in the generated documentation, and make
+ // it more clear that this is a *borrowed* split.
+ #[allow(clippy::needless_lifetimes)]
/// Splits a `TcpStream` into a read half and a write half, which can be used
/// to read and write the stream concurrently.
///
@@ -666,7 +669,7 @@ impl TcpStream {
/// moved into independently spawned tasks.
///
/// [`into_split`]: TcpStream::into_split()
- pub fn split(&mut self) -> (ReadHalf<'_>, WriteHalf<'_>) {
+ pub fn split<'a>(&'a mut self) -> (ReadHalf<'a>, WriteHalf<'a>) {
split(self)
}
@@ -676,10 +679,11 @@ impl TcpStream {
/// Unlike [`split`], the owned halves can be moved to separate tasks, however
/// this comes at the cost of a heap allocation.
///
- /// **Note::** Dropping the write half will shutdown the write half of the TCP
- /// stream. This is equivalent to calling `shutdown(Write)` on the `TcpStream`.
+ /// **Note:** Dropping the write half will shut down the write half of the TCP
+ /// stream. This is equivalent to calling [`shutdown(Write)`] on the `TcpStream`.
///
/// [`split`]: TcpStream::split()
+ /// [`shutdown(Write)`]: fn@crate::net::TcpStream::shutdown
pub fn into_split(self) -> (OwnedReadHalf, OwnedWriteHalf) {
split_owned(self)
}