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 @@ -50,6 +50,21 @@ pub trait Body {
5050 cx : & mut Context < ' _ > ,
5151 ) -> Poll < Option < Result < Frame < Self :: Data > , Self :: Error > > > ;
5252
53+ /// Determine if the body is still in a healthy state without polling for the next frame.
54+ ///
55+ /// `Body` consumers can use this method to check if the body has entered an error state even
56+ /// when the consumer is not yet ready to try to read the next frame. Since healthiness is not
57+ /// an operation that completes, this method returns just a `Result` rather than a `Poll`.
58+ ///
59+ /// For example, a `Body` implementation could maintain a timer counting down betwen
60+ /// `poll_frame` calls and report an error from `poll_healthy` when time expires.
61+ ///
62+ /// The default implementation returns `Ok(())`.
63+ fn poll_healthy ( self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Result < ( ) , Self :: Error > {
64+ let _ = cx;
65+ Ok ( ( ) )
66+ }
67+
5368 /// Returns `true` when the end of stream has been reached.
5469 ///
5570 /// An end of stream means that `poll_frame` will return `None`.
You can’t perform that action at this time.
0 commit comments