Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions src/client/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,36 @@ impl<T> TrySendError<T> {
}
}

impl<B> crate::client::conn::http1::SendRequest<B> {
/// Polls to determine whether this sender can be used yet for a request.
///
/// If the associated connection is closed, this returns a [`TrySendError<T>`].
pub fn try_poll_ready(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Result<(), TrySendError<Request<B>>>> {
self.poll_ready(cx).map_err(|error| TrySendError {
error,
message: None,
})
}
}

impl<B> crate::client::conn::http2::SendRequest<B> {
/// Polls to determine whether this sender can be used yet for a request.
///
/// If the associated connection is closed, this returns a [`TrySendError<T>`].
pub fn try_poll_ready(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Result<(), TrySendError<Request<B>>>> {
self.poll_ready(cx).map_err(|error| TrySendError {
error,
message: None,
})
}
}

#[cfg(feature = "http2")]
pin_project! {
pub struct SendWhen<B>
Expand Down
Loading