Skip to content

Commit

Permalink
docs: notes on poll_frame return values (#144)
Browse files Browse the repository at this point in the history
Signed-off-by: katelyn martin <[email protected]>
  • Loading branch information
cratelyn authored Jan 31, 2025
1 parent 261b2df commit 1090bff
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion http-body/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,22 @@ pub trait Body {
type Error;

#[allow(clippy::type_complexity)]
/// Attempt to pull out the next data buffer of this stream.
/// Attempt to pull out the next frame of this stream.
///
/// # Return value
///
/// This function returns:
///
/// - [`Poll::Pending`] if the next frame is not ready yet.
/// - [`Poll::Ready(Some(Ok(frame)))`] when the next frame is available.
/// - [`Poll::Ready(Some(Err(error)))`] when an error has been reached.
/// - [`Poll::Ready(None)`] means that all of the frames in this stream have been returned, and
/// that the end of the stream has been reached.
///
/// If [`Poll::Ready(Some(Err(error)))`] is returned, this body should be discarded.
///
/// Once the end of the stream is reached, implementations should continue to return
/// [`Poll::Ready(None)`].
fn poll_frame(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
Expand Down

0 comments on commit 1090bff

Please sign in to comment.