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.
This commit is contained in:
Yuki Okushi 2020-01-29 18:56:34 +09:00 committed by GitHub
commit 50df7880a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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