Trait HttpService

Source
pub trait HttpService<B>: Sealed<B> {
    type ResponseBody: Body;
    type Error;
    type Future: Future<Output = Result<Response<Self::ResponseBody>, Self::Error>>;

    // Required methods
    fn poll_ready(
        &mut self,
        cx: &mut Context<'_>,
    ) -> Poll<Result<(), Self::Error>>;
    fn call(&mut self, request: Request<B>) -> Self::Future;
}
Expand description

An HTTP client (like hyper::Client).

This is just an alias for tower_service::Service introduced to reduce the number of type parameters.

Required Associated Types§

Source

type ResponseBody: Body

Body of the responses given by the service.

Source

type Error

Source

type Future: Future<Output = Result<Response<Self::ResponseBody>, Self::Error>>

Required Methods§

Source

fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>>

Source

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

Implementors§

Source§

impl<S, ReqB, ResB> HttpService<ReqB> for S
where S: Service<Request<ReqB>, Response = Response<ResB>> + ?Sized, ResB: Body,

Source§

type ResponseBody = ResB

Source§

type Error = <S as Service<Request<ReqB>>>::Error

Source§

type Future = <S as Service<Request<ReqB>>>::Future