summaryrefslogtreecommitdiffstats
path: root/tokio/src/net/tcp/stream.rs
diff options
context:
space:
mode:
authorMathspy <mathspy257@gmail.com>2020-05-28 10:11:55 +0200
committerGitHub <noreply@github.com>2020-05-28 10:11:55 +0200
commitf7574d902381c3708b1f295890807885b4559a9c (patch)
treef48d449655b18b9806d124d1919330a58a8ee4de /tokio/src/net/tcp/stream.rs
parent954f2b73048d91ec3613e5db901aa17fd6f31bef (diff)
net: add note about into_split's drop (#2567)
This took me a bit to catch on to because I didn't really think there was any reason to investigate the individual documentation of each half. As someone dealing with TCP streams directly for first time (without previous experience from other languages) this caught me by surprise
Diffstat (limited to 'tokio/src/net/tcp/stream.rs')
-rw-r--r--tokio/src/net/tcp/stream.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/tokio/src/net/tcp/stream.rs b/tokio/src/net/tcp/stream.rs
index ee44f810..92c7c84e 100644
--- a/tokio/src/net/tcp/stream.rs
+++ b/tokio/src/net/tcp/stream.rs
@@ -652,6 +652,8 @@ 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 close the TCP stream in both directions.
+ ///
/// [`split`]: TcpStream::split()
pub fn into_split(self) -> (OwnedReadHalf, OwnedWriteHalf) {
split_owned(self)