Skip to content

Commit 50df788

Browse files
authored
Rollup merge of #68627 - joshtriplett:write-all-none, r=Dylan-DPC
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.
2 parents 0e36558 + 9bb2a50 commit 50df788

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/libstd/io/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1327,6 +1327,8 @@ pub trait Write {
13271327
/// not of [`ErrorKind::Interrupted`] kind generated from this method will be
13281328
/// returned.
13291329
///
1330+
/// If the buffer contains no data, this will never call [`write`].
1331+
///
13301332
/// # Errors
13311333
///
13321334
/// This function will return the first error of

0 commit comments

Comments
 (0)