Skip to content

Commit

Permalink
Rollup merge of rust-lang#68627 - joshtriplett:write-all-none, r=Dyla…
Browse files Browse the repository at this point in the history
…n-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.
  • Loading branch information
JohnTitor authored Jan 29, 2020
2 parents 0e36558 + 9bb2a50 commit 50df788
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/libstd/io/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 50df788

Please sign in to comment.