Skip to content

Commit 395b18e

Browse files
committed
Rename to poll_progress
1 parent 385a612 commit 395b18e

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

http-body/src/lib.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,18 @@ pub trait Body {
5050
cx: &mut Context<'_>,
5151
) -> Poll<Option<Result<Frame<Self::Data>, Self::Error>>>;
5252

53-
/// Determine if the body is still in a healthy state without polling for the next frame.
53+
/// Attempt to progress the body's state without pulling a new frame.
5454
///
55-
/// `Body` consumers can use this method to check if the body has entered an error state even
56-
/// when the consumer is not yet ready to try to read the next frame. Since healthiness is not
57-
/// an operation that completes, this method returns just a `Result` rather than a `Poll`.
55+
/// `Body` consumers can use this method to allow the `Body` implementation to continue to
56+
/// perform work even when the consumer is not yet ready to read the next frame. For example,
57+
/// a `Body` implementation could maintain a timer counting down between `poll_frame` calls and
58+
/// report an error from `poll_progress` when time expires.
5859
///
59-
/// For example, a `Body` implementation could maintain a timer counting down between
60-
/// `poll_frame` calls and report an error from `poll_healthy` when time expires.
61-
///
62-
/// The default implementation returns `Ok(())`.
63-
fn poll_healthy(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Result<(), Self::Error> {
60+
/// Consumers are *not* required to call this method. A `Body` implementation should not depend
61+
/// on calls to `poll_progress` to occur.
62+
fn poll_progress(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
6463
let _ = cx;
65-
Ok(())
64+
Poll::Ready(Ok(()))
6665
}
6766

6867
/// Returns `true` when the end of stream has been reached.

0 commit comments

Comments
 (0)