Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions http-body/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,21 @@ pub trait Body {
cx: &mut Context<'_>,
) -> Poll<Option<Result<Frame<Self::Data>, Self::Error>>>;

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

/// Returns the bounds on the remaining length of the stream.
/// A hint that returns the bounds on the remaining length of the stream.
///
/// When the **exact** remaining length of the stream is known, the upper bound will be set and
/// will equal the lower bound.
Expand Down
Loading