This commit is contained in:
nora 2022-09-15 22:46:16 +02:00
parent 22d798bb53
commit d4e9233099

View file

@ -45,10 +45,10 @@ pub trait Service<Request> {
type Future; type Future;
} }
pub trait MakeService<Request> { pub trait MakeService {
type Response; type Response;
type Error; type Error;
type Service: Service<Request, Error = Self::Error>; type Service: Service<(), Error = Self::Error>;
type Future; type Future;
} }
@ -74,14 +74,14 @@ impl<D, Req> Service<Req> for Balance<D, Req> {
pub struct PoolDiscoverer<MS, Request> pub struct PoolDiscoverer<MS, Request>
where where
MS: MakeService<Request>, MS: MakeService,
{ {
_p: PhantomData<(MS, Request)>, _p: PhantomData<(MS, Request)>,
} }
impl<MS, Request> Stream for PoolDiscoverer<MS, Request> impl<MS, Request> Stream for PoolDiscoverer<MS, Request>
where where
MS: MakeService<Request>, MS: MakeService,
{ {
type Item = (usize, SvcWrap<MS::Service>); type Item = (usize, SvcWrap<MS::Service>);
} }
@ -91,7 +91,7 @@ pub struct Builder {}
impl Builder { impl Builder {
pub fn build<MS, Request>() pub fn build<MS, Request>()
where where
MS: MakeService<Request>, MS: MakeService,
MS::Error: Into<crate::BoxError>, MS::Error: Into<crate::BoxError>,
{ {
let d: PoolDiscoverer<MS, Request> = todo!(); let d: PoolDiscoverer<MS, Request> = todo!();
@ -107,7 +107,7 @@ pub struct Pool<MS, Request> {
impl<MS, Req> Service<Req> for Pool<MS, Req> impl<MS, Req> Service<Req> for Pool<MS, Req>
where where
MS: MakeService<Req>, MS: MakeService,
MS::Error: Into<crate::BoxError>, MS::Error: Into<crate::BoxError>,
{ {
type Error = <Balance<PoolDiscoverer<MS, Req>, Req> as Service<Req>>::Error; type Error = <Balance<PoolDiscoverer<MS, Req>, Req> as Service<Req>>::Error;