From 9bb2a50e04460fff646830502d575b82dbf17055 Mon Sep 17 00:00:00 2001 From: Josh Triplett Date: Tue, 28 Jan 2020 17:22:38 -0800 Subject: [PATCH] Document that write_all will not call write if given an empty buffer Some types of Write instances have a semantic meaning associated with writing an empty buffer, such as sending an empty packet. This works when calling `write` directly, and supplying an empty buffer. However, calling `write_all` on an empty buffer will simply never call `write`, because `write_all` assumes it has no work to do. Document this behavior, to help prospective users of datagram-packet-style Write instances. --- src/libstd/io/mod.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index 95c8934b3d692..67b382c7a845e 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -1327,6 +1327,8 @@ pub trait Write { /// not of [`ErrorKind::Interrupted`] kind generated from this method will be /// returned. /// + /// If the buffer contains no data, this will never call [`write`]. + /// /// # Errors /// /// This function will return the first error of