Skip to content

Commit 0829679

Browse files
committed
docs: notes on poll_frame return values
Signed-off-by: katelyn martin <me+cratelyn@katelyn.world>
1 parent 261b2df commit 0829679

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

http-body/src/lib.rs

+15
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,21 @@ pub trait Body {
4444

4545
#[allow(clippy::type_complexity)]
4646
/// Attempt to pull out the next data buffer of this stream.
47+
///
48+
/// # Return value
49+
///
50+
/// This function returns:
51+
///
52+
/// - [`Poll::Pending`] if the next frame is not ready yet.
53+
/// - [`Poll::Ready(Some(Ok(frame)))`] when the next frame is available.
54+
/// - [`Poll::Ready(Some(Err(error)))`] when an error has been reached.
55+
/// - [`Poll::Ready(None)`] means that all of the frames in this stream have been returned, and
56+
/// that the end of the stream has been reached.
57+
///
58+
/// If [`Poll::Ready(Some(Err(error)))`] is returned, this body should be discarded.
59+
///
60+
/// Once the end of the stream is reached, implementations should continue to return
61+
/// [`Poll::Ready(None)`].
4762
fn poll_frame(
4863
self: Pin<&mut Self>,
4964
cx: &mut Context<'_>,

0 commit comments

Comments
 (0)