From 30db493e9d25bb576a978ddef7c0c728bdc01071 Mon Sep 17 00:00:00 2001 From: Oliver Gould Date: Wed, 6 Mar 2024 21:52:25 +0000 Subject: [PATCH] https://github.com/hyperium/http-body/pull/90 --- src/lib.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 2535cda..73e8ffe 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -58,6 +58,20 @@ pub trait Body { cx: &mut Context<'_>, ) -> Poll>>; + /// Attempt to progress the body's state without pulling a new frame. + /// + /// `Body` consumers can use this method to allow the `Body` implementation to continue to + /// perform work even when the consumer is not yet ready to read the next frame. For example, + /// a `Body` implementation could maintain a timer counting down between `poll_data` calls and + /// report an error from `poll_progress` when time expires. + /// + /// Consumers are *not* required to call this method. A `Body` implementation should not depend + /// on calls to `poll_progress` to occur. + fn poll_progress(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { + let _ = cx; + Poll::Ready(Ok(())) + } + /// Poll for an optional **single** `HeaderMap` of trailers. /// /// This function should only be called once `poll_data` returns `None`.