diff --git a/src/client/dispatch.rs b/src/client/dispatch.rs index 412f7af52c..15bef5b630 100644 --- a/src/client/dispatch.rs +++ b/src/client/dispatch.rs @@ -323,6 +323,36 @@ impl TrySendError { } } +impl crate::client::conn::http1::SendRequest { + /// Polls to determine whether this sender can be used yet for a request. + /// + /// If the associated connection is closed, this returns a [`TrySendError`]. + pub fn try_poll_ready( + &mut self, + cx: &mut Context<'_>, + ) -> Poll>>> { + self.poll_ready(cx).map_err(|error| TrySendError { + error, + message: None, + }) + } +} + +impl crate::client::conn::http2::SendRequest { + /// Polls to determine whether this sender can be used yet for a request. + /// + /// If the associated connection is closed, this returns a [`TrySendError`]. + pub fn try_poll_ready( + &mut self, + cx: &mut Context<'_>, + ) -> Poll>>> { + self.poll_ready(cx).map_err(|error| TrySendError { + error, + message: None, + }) + } +} + #[cfg(feature = "http2")] pin_project! { pub struct SendWhen