From 6d18230b95c4d90a0f5a15945b65c6ea2ca1a858 Mon Sep 17 00:00:00 2001 From: Mathspy Date: Thu, 28 May 2020 10:11:55 +0200 Subject: [PATCH] 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 --- tokio/src/net/tcp/stream.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tokio/src/net/tcp/stream.rs b/tokio/src/net/tcp/stream.rs index ee44f810c37..92c7c84e4c4 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)