1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
use http::{Request, Response};
use http_body::Body;
use tower_service::Service;
use private::Sealed;
#[cfg_attr(not(feature = "hyper"), allow(intra_doc_link_resolution_failure))]
pub trait HttpService<B>: Service<Request<B>> + Sealed<B> {
type ResponseBody: Body;
}
impl<S, ReqB, ResB> HttpService<ReqB> for S
where
S: Service<Request<ReqB>, Response = Response<ResB>> + ?Sized,
ResB: Body,
{
type ResponseBody = ResB;
}
mod private {
use http::{Request, Response};
use http_body::Body;
use tower_service::Service;
pub trait Sealed<B> {}
impl<S, ReqB, ResB> Sealed<ReqB> for S
where
S: Service<Request<ReqB>, Response = Response<ResB>> + ?Sized,
ResB: Body,
{
}
}