pub trait HttpService:
Sealed
+ Clone
+ Send
+ Sync
+ 'static {
type ResponseBody: Body<Data: Send, Error: Into<BoxError>> + Send + 'static;
type Error: Into<BoxError>;
type Future: Future<Output = Result<Response<Self::ResponseBody>, Self::Error>> + Send;
// Required methods
fn poll_ready(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Result<(), Self::Error>>;
fn call(&mut self, request: Request<Body>) -> Self::Future;
}Expand description
What a transport has to be: a tower service that takes an http request
with this crate’s Body and answers with an http response.
It is implemented for every tower_service::Service that fits, and for
nothing else, so it is a name for a set of bounds rather than a trait to
implement: implement Service and a type is a transport. The service is
cloned for every request and driven with its own poll_ready, so a
service with back-pressure keeps it; the default HyperTransport is
always ready.
The error of the service, and of its response body, is anything that can
cross threads. It is kept as the source of the
connection Error the call fails with.
Required Associated Types§
Required Methods§
Sourcefn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>>
fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>>
Service::poll_ready, forwarded.
§Errors
Returns the service’s error when it can take no more requests.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".