From 08296799a85918deacdb35ff4f0c4a5e40367cd1 Mon Sep 17 00:00:00 2001 From: katelyn martin Date: Fri, 10 Jan 2025 00:00:00 +0000 Subject: [PATCH 1/2] docs: notes on poll_frame return values Signed-off-by: katelyn martin --- http-body/src/lib.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/http-body/src/lib.rs b/http-body/src/lib.rs index e27c20d..8be7c47 100644 --- a/http-body/src/lib.rs +++ b/http-body/src/lib.rs @@ -44,6 +44,21 @@ pub trait Body { #[allow(clippy::type_complexity)] /// Attempt to pull out the next data buffer 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<'_>, From eeafd3314e93b04cd77aa48c4a7584e290d9eb9e Mon Sep 17 00:00:00 2001 From: katelyn martin Date: Fri, 10 Jan 2025 00:00:00 +0000 Subject: [PATCH 2/2] review: update stale "data buffer" terminology Signed-off-by: katelyn martin --- http-body/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/http-body/src/lib.rs b/http-body/src/lib.rs index 8be7c47..0470906 100644 --- a/http-body/src/lib.rs +++ b/http-body/src/lib.rs @@ -43,7 +43,7 @@ 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 ///