[][src]Trait tower_h2::HttpService

pub trait HttpService<RequestBody>: Sealed<RequestBody> where
    <Self::Future as Future>::Item == Response<Self::ResponseBody>,
    <Self::Future as Future>::Error == Self::Error
{ type ResponseBody: Body; type Error; type Future: Future; fn poll_ready(&mut self) -> Result<Async<()>, Self::Error>;
fn call(&mut self, request: Request<RequestBody>) -> Self::Future; fn into_service(self) -> IntoService<Self> { ... }
fn as_service(&mut self) -> AsService<Self> { ... } }

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

The future response value.

Loading content...

Required methods

fn poll_ready(&mut self) -> Result<Async<()>, 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.

Loading content...

Provided methods

fn into_service(self) -> IntoService<Self>

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>

Same as into_service but operates on an HttpService reference.

Loading content...

Implementors

impl<T, B1, B2> HttpService<B1> for T where
    B2: Body,
    T: Service<Request<B1>, Response = Response<B2>>, 
[src]

type ResponseBody = B2

type Error = <T as Service<Request<B1>>>::Error

type Future = <T as Service<Request<B1>>>::Future

fn into_service(self) -> IntoService<Self>[src]

fn as_service(&mut self) -> AsService<Self>[src]

Loading content...