pub trait HttpService<RequestBody>: Sealed<RequestBody> {
type ResponseBody: Body;
type Error;
type Future: Future<Item = Response<Self::ResponseBody>, Error = Self::Error>;
// Required methods
fn poll_ready(&mut self) -> Poll<(), Self::Error>;
fn call(&mut self, request: Request<RequestBody>) -> Self::Future;
// Provided methods
fn into_service(self) -> IntoService<Self>
where Self: Sized { ... }
fn as_service(&mut self) -> AsService<'_, Self>
where Self: Sized { ... }
}Expand description
An HTTP service
This is not intended to be implemented directly. Instead, it is a trait
alias of sorts. Implements the tower_service::Service trait using
http::Request and http::Response types.
Required Associated Types§
Sourcetype ResponseBody: Body
type ResponseBody: Body
Response payload.
Required Methods§
Sourcefn poll_ready(&mut self) -> Poll<(), Self::Error>
fn poll_ready(&mut self) -> Poll<(), Self::Error>
Returns Ready when the service is able to process requests.
Provided Methods§
Sourcefn into_service(self) -> IntoService<Self>where
Self: Sized,
fn into_service(self) -> IntoService<Self>where
Self: Sized,
Wrap the HttpService so that it implements tower_service::Service directly.
Since HttpService does not directly implement Service, if an
HttpService instance needs to be used where a T: Service is
required, it must be wrapped with a type that provides that
implementation. IntoService does this.
Sourcefn as_service(&mut self) -> AsService<'_, Self>where
Self: Sized,
fn as_service(&mut self) -> AsService<'_, Self>where
Self: Sized,
Same as into_service but operates on an HttpService reference.