Skip to content

Commit

Permalink
doc: clarify EOF condition for AsyncReadExt::read_buf (#3850)
Browse files Browse the repository at this point in the history
  • Loading branch information
emesterhazy committed Jun 9, 2021
1 parent e7d74b3 commit d16e506
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions tokio/src/io/util/async_read_ext.rs
Expand Up @@ -108,6 +108,8 @@ cfg_io_util! {
/// This function does not provide any guarantees about whether it
/// completes immediately or asynchronously
///
/// # Return
///
/// If the return value of this method is `Ok(n)`, then it must be
/// guaranteed that `0 <= n <= buf.len()`. A nonzero `n` value indicates
/// that the buffer `buf` has been filled in with `n` bytes of data from
Expand Down Expand Up @@ -180,9 +182,14 @@ cfg_io_util! {
///
/// # Return
///
/// On a successful read, the number of read bytes is returned. If the
/// supplied buffer is not empty and the function returns `Ok(0)` then
/// the source has reached an "end-of-file" event.
/// A nonzero `n` value indicates that the buffer `buf` has been filled
/// in with `n` bytes of data from this source. If `n` is `0`, then it
/// can indicate one of two scenarios:
///
/// 1. This reader has reached its "end of file" and will likely no longer
/// be able to produce bytes. Note that this does not mean that the
/// reader will *always* no longer be able to produce bytes.
/// 2. The buffer specified had a remaining capacity of zero.
///
/// # Errors
///
Expand Down

1 comment on commit d16e506

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'sync_mpsc'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: d16e506 Previous: e7d74b3 Ratio
send_large 57284 ns/iter (± 4959) 25342 ns/iter (± 7475) 2.26

This comment was automatically generated by workflow using github-action-benchmark.

CC: @tokio-rs/maintainers

Please sign in to comment.