io: update AsyncRead::poll_read doc (#3557)

The trait-level documentation accurately describes this method, but the
function-level documentation imples that an implementer should overwrite
the entire buf, rather than just the unfilled portion.
This commit is contained in:
Paho Lurie-Gregg 2021-02-25 14:19:02 -08:00 committed by GitHub
parent 112e160b62
commit 017a483b5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -43,9 +43,9 @@ use std::task::{Context, Poll};
pub trait AsyncRead {
/// Attempts to read from the `AsyncRead` into `buf`.
///
/// On success, returns `Poll::Ready(Ok(()))` and fills `buf` with data
/// read. If no data was read (`buf.filled().is_empty()`) it implies that
/// EOF has been reached.
/// On success, returns `Poll::Ready(Ok(()))` and places data in the
/// unfilled portion of `buf`. If no data was read (`buf.filled().len()` is
/// unchanged), it implies that EOF has been reached.
///
/// If no data is available for reading, the method returns `Poll::Pending`
/// and arranges for the current task (via `cx.waker()`) to receive a