Skip to content

Commit

Permalink
Rollup merge of #72031 - Elinvynia:master, r=Mark-Simulacrum
Browse files Browse the repository at this point in the history
Better documentation for io::Read::read() return value

Aims to provide the clarity requested in #70360
  • Loading branch information
Dylan-DPC authored May 9, 2020
2 parents 46d97c2 + 05fc7fa commit 4b337d2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/libstd/io/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,11 @@ pub trait Read {
/// reader will *always* no longer be able to produce bytes.
/// 2. The buffer specified was 0 bytes in length.
///
/// It is not an error if the returned value `n` is smaller than the buffer size,
/// even when the reader is not at the end of the stream yet.
/// This may happen for example because fewer bytes are actually available right now
/// (e. g. being close to end-of-file) or because read() was interrupted by a signal.
///
/// No guarantees are provided about the contents of `buf` when this
/// function is called, implementations cannot rely on any property of the
/// contents of `buf` being true. It is recommended that *implementations*
Expand Down

0 comments on commit 4b337d2

Please sign in to comment.