feat(client): `TrySendError<T>` is `From<Error>` by cratelyn · Pull Request #3883 · hyperium/hyper
cratelyn
marked this pull request as ready for review
cratelyn added a commit to cratelyn/hyper that referenced this pull request
May 22, 2025this change is motivated by aiming to use interfaces like `hyper::client::conn::http2::SendRequest::try_send_request()` or `hyper::client::conn::http1::SendRequest::try_send_request()` in the context of tower middleware; the `Service<T>` trait's signature is such that the same error type be returned from `Service::poll_ready()` and `Service::call()`. this means that services that might resolve to a recovered message may call `try_poll_ready` when polling for readiness. this avoids making `TrySendError<T>` constructable externally, see hyperium#3883 as an alternate approach that was considered. Signed-off-by: katelyn martin <git@katelyn.world>
cratelyn added a commit to cratelyn/hyper that referenced this pull request
Jul 29, 2025this commit introduces a `std::error::Error` implementation for `hyper::client::conn::TrySendError`. this allows callers of `hyper::client::conn::http2::SendRequest::try_send_request()` or `hyper::client::conn::http1::SendRequest::try_send_request()` to box a `TrySendError<T>` without discarding a potentially recovered message. a `std::fmt::Display` implementation is added in this commit, because it is a prerequisite for implementations of `std::error::Error`. for some previous discussion on this topic, see "_other options_" here: hyperium#3883 (comment). Ref: hyperium#3883 Ref: hyperium#3892 Signed-off-by: katelyn martin <git@katelyn.world>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters