HttpService

Trait HttpService 

Source
pub trait HttpService {
    type RequestBody;
    type ResponseBody;
    type Error;
    type Future: Future<Item = Response<Self::ResponseBody>, Error = Self::Error>;

    // Required method
    fn call(&mut self, request: Request<Self::RequestBody>) -> Self::Future;
}
Expand description

Trait representing an asynchronous function from an HTTP request to an HTTP response.

Required Associated Types§

Source

type RequestBody

The type of message body in the request.

Source

type ResponseBody

The type of message body in the response.

Source

type Error

The type of error which will be returned from this service.

Source

type Future: Future<Item = Response<Self::ResponseBody>, Error = Self::Error>

A Future which will be returned from call and resolved as an HTTP response.

Required Methods§

Source

fn call(&mut self, request: Request<Self::RequestBody>) -> Self::Future

Apply an HTTP request to this service and get a future which will be resolved as an HTTP response.

Implementations on Foreign Types§

Source§

impl<S: HttpService> HttpService for Box<S>

Implementors§