Skip to content

Commit 261b2df

Browse files
authored
docs: is_end_stream is a hint (#143)
1 parent 86fdf00 commit 261b2df

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

http-body/src/lib.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,21 @@ pub trait Body {
4949
cx: &mut Context<'_>,
5050
) -> Poll<Option<Result<Frame<Self::Data>, Self::Error>>>;
5151

52-
/// Returns `true` when the end of stream has been reached.
52+
/// A hint that may return `true` when the end of stream has been reached.
5353
///
5454
/// An end of stream means that `poll_frame` will return `None`.
5555
///
5656
/// A return value of `false` **does not** guarantee that a value will be
57-
/// returned from `poll_frame`.
57+
/// returned from `poll_frame`. Combinators or other implementations may
58+
/// not be able to know the end of stream has been reached for this hint.
59+
///
60+
/// Returning `true` allows consumers of this body to optimize, such as not
61+
/// calling `poll_frame` again.
5862
fn is_end_stream(&self) -> bool {
5963
false
6064
}
6165

62-
/// Returns the bounds on the remaining length of the stream.
66+
/// A hint that returns the bounds on the remaining length of the stream.
6367
///
6468
/// When the **exact** remaining length of the stream is known, the upper bound will be set and
6569
/// will equal the lower bound.

0 commit comments

Comments
 (0)