File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,21 @@ pub trait Body {
4747 cx : & mut Context < ' _ > ,
4848 ) -> Poll < Option < Result < Frame < Self :: Data > , Self :: Error > > > ;
4949
50+ /// Determine if the body is still in a healthy state without polling for the next frame.
51+ ///
52+ /// `Body` consumers can use this method to check if the body has entered an error state even
53+ /// when the consumer is not yet ready to try to read the next frame. Since healthiness is not
54+ /// an operation that completes, this method returns just a `Result` rather than a `Poll`.
55+ ///
56+ /// For example, a `Body` implementation could maintain a timer counting down betwen
57+ /// `poll_frame` calls and report an error from `poll_healthy` when time expires.
58+ ///
59+ /// The default implementation returns `Ok(())`.
60+ fn poll_healthy ( self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Result < ( ) , Self :: Error > {
61+ let _ = cx;
62+ Ok ( ( ) )
63+ }
64+
5065 /// Returns `true` when the end of stream has been reached.
5166 ///
5267 /// An end of stream means that `poll_frame` will return `None`.
You can’t perform that action at this time.
0 commit comments