Skip to content

Commit 1090bff

Browse files
authored
docs: notes on poll_frame return values (#144)
Signed-off-by: katelyn martin <me+cratelyn@katelyn.world>
1 parent 261b2df commit 1090bff

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

http-body/src/lib.rs

+16-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,22 @@ pub trait Body {
4343
type Error;
4444

4545
#[allow(clippy::type_complexity)]
46-
/// Attempt to pull out the next data buffer of this stream.
46+
/// Attempt to pull out the next frame 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)