pub trait Service {
type ReqBody: hyper::body::Payload;
type Future: futures::Future;
fn request(&self, req: hyper::Request<Self::ReqBody>) -> Self::Future;
}
impl<C, B> Service for hyper::Client<C, B>
where
B: hyper::body::Payload + Send + 'static,
B::Data: Send,
C: hyper::client::connect::Connect + Sync + 'static,
C::Transport: 'static,
C::Future: 'static,
{
type ReqBody = B;
type Future = hyper::client::ResponseFuture;
fn request(&self, req: hyper::Request<Self::ReqBody>) -> Self::Future {
hyper::Client::request(self, req)
}
}
pub trait MakeService<Context> {
type Service: Service;
type Error;
type Future: futures::Future<Item = Self::Service, Error = Self::Error>;
fn make_service(&self, ctx: Context) -> Self::Future;
}