[−][src]Trait tower_http_util::service::HttpService
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.
Associated Types
type ResponseBody: Body
Response payload.
type Error
Errors produced by the service.
type Future: Future<Item = Response<Self::ResponseBody>, Error = Self::Error>
The future response value.
Required methods
fn poll_ready(&mut self) -> Poll<(), Self::Error>
Returns Ready
when the service is able to process requests.
fn call(&mut self, request: Request<RequestBody>) -> Self::Future
Process the request and return the response asynchronously.
Provided methods
fn into_service(self) -> IntoService<Self> where
Self: Sized,
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.
fn as_service(&mut self) -> AsService<Self> where
Self: Sized,
Self: Sized,
Same as into_service
but operates on an HttpService reference.
Implementors
impl<T, B1, B2> HttpService<B1> for T where
T: Service<Request<B1>, Response = Response<B2>>,
B2: Body,
[src]
T: Service<Request<B1>, Response = Response<B2>>,
B2: Body,
type ResponseBody = B2
type Error = T::Error
type Future = T::Future
fn poll_ready(&mut self) -> Poll<(), Self::Error>
[src]
fn call(&mut self, request: Request<B1>) -> Self::Future
[src]
fn into_service(self) -> IntoService<Self> where
Self: Sized,
[src]
Self: Sized,
fn as_service(&mut self) -> AsService<Self> where
Self: Sized,
[src]
Self: Sized,