Seal the MakeService trait
This commit is contained in:
parent
f21e3e4df0
commit
b8c15904fe
|
@ -237,7 +237,7 @@ where T: Service<Request>,
|
||||||
/// requests on that new TCP stream.
|
/// requests on that new TCP stream.
|
||||||
///
|
///
|
||||||
/// This is essentially a trait alias for a `Service` of `Service`s.
|
/// This is essentially a trait alias for a `Service` of `Service`s.
|
||||||
pub trait MakeService<Target, Request> {
|
pub trait MakeService<Target, Request>: self::sealed::Sealed<Target, Request> {
|
||||||
/// Responses given by the service
|
/// Responses given by the service
|
||||||
type Response;
|
type Response;
|
||||||
|
|
||||||
|
@ -268,6 +268,11 @@ pub trait MakeService<Target, Request> {
|
||||||
fn make_service(&mut self, target: Target) -> Self::Future;
|
fn make_service(&mut self, target: Target) -> Self::Future;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<M, S, Target, Request> self::sealed::Sealed<Target, Request> for M
|
||||||
|
where M: Service<Target, Response=S>,
|
||||||
|
S: Service<Request>,
|
||||||
|
{}
|
||||||
|
|
||||||
impl<M, S, Target, Request> MakeService<Target, Request> for M
|
impl<M, S, Target, Request> MakeService<Target, Request> for M
|
||||||
where M: Service<Target, Response=S>,
|
where M: Service<Target, Response=S>,
|
||||||
S: Service<Request>,
|
S: Service<Request>,
|
||||||
|
@ -320,3 +325,7 @@ where
|
||||||
(**self).call(request)
|
(**self).call(request)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mod sealed {
|
||||||
|
pub trait Sealed<A, B> {}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue