mirror of
https://github.com/Noratrieb/101844-repro.git
synced 2026-01-14 14:25:02 +01:00
remove bounds
This commit is contained in:
parent
ca3a6684cb
commit
28b397587e
2 changed files with 2 additions and 56 deletions
|
|
@ -1,4 +1,3 @@
|
|||
use crate::load::Load;
|
||||
use crate::MakeService;
|
||||
use crate::Service;
|
||||
use crate::{Change, Discover};
|
||||
|
|
@ -31,8 +30,7 @@ where
|
|||
D: Discover + Unpin,
|
||||
D::Key: Hash + Clone,
|
||||
D::Error: Into<crate::BoxError>,
|
||||
D::Service: Service<Req> + Load,
|
||||
<D::Service as Load>::Metric: std::fmt::Debug,
|
||||
D::Service: Service<Req>,
|
||||
<D::Service as Service<Req>>::Error: Into<crate::BoxError>,
|
||||
{
|
||||
type Response = <D::Service as Service<Req>>::Response;
|
||||
|
|
@ -54,7 +52,7 @@ impl<MS, Target, Request> Stream for PoolDiscoverer<MS, Target, Request>
|
|||
where
|
||||
MS: MakeService<Target, Request>,
|
||||
{
|
||||
type Item = Result<Change<usize, DropNotifyService<MS::Service>>, MS::MakeError>;
|
||||
type Item = Result<Change<usize, DropNotifyService<MS::Service>>, MS::Error>;
|
||||
|
||||
fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
|
||||
todo!()
|
||||
|
|
@ -67,9 +65,6 @@ impl Builder {
|
|||
pub fn build<MS, Target, Request>() -> ()
|
||||
where
|
||||
MS: MakeService<Target, Request>,
|
||||
MS::Service: Load,
|
||||
<MS::Service as Load>::Metric: std::fmt::Debug,
|
||||
MS::MakeError: Into<crate::BoxError>,
|
||||
MS::Error: Into<crate::BoxError>,
|
||||
{
|
||||
let d: PoolDiscoverer<MS, Target, Request> = todo!();
|
||||
|
|
@ -90,11 +85,7 @@ type PinBalance<S, Request> = Balance<Pin<Box<S>>, Request>;
|
|||
impl<MS, Target, Req> Service<Req> for Pool<MS, Target, Req>
|
||||
where
|
||||
MS: MakeService<Target, Req>,
|
||||
MS::Service: Load,
|
||||
<MS::Service as Load>::Metric: std::fmt::Debug,
|
||||
MS::MakeError: Into<crate::BoxError>,
|
||||
MS::Error: Into<crate::BoxError>,
|
||||
Target: Clone,
|
||||
{
|
||||
type Response = <PinBalance<PoolDiscoverer<MS, Target, Req>, Req> as Service<Req>>::Response;
|
||||
type Error = <PinBalance<PoolDiscoverer<MS, Target, Req>, Req> as Service<Req>>::Error;
|
||||
|
|
@ -105,14 +96,6 @@ pub struct DropNotifyService<Svc> {
|
|||
svc: Svc,
|
||||
}
|
||||
|
||||
|
||||
impl<Svc: Load> Load for DropNotifyService<Svc> {
|
||||
type Metric = Svc::Metric;
|
||||
fn load(&self) -> Self::Metric {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl<Request, Svc: Service<Request>> Service<Request> for DropNotifyService<Svc> {
|
||||
type Response = Svc::Response;
|
||||
type Future = Svc::Future;
|
||||
|
|
|
|||
|
|
@ -1,32 +1,15 @@
|
|||
pub mod balance;
|
||||
|
||||
use futures_core::TryStream;
|
||||
use std::future::Future;
|
||||
pub trait Sealed<T> {}
|
||||
|
||||
/// Alias for a type-erased error type.
|
||||
pub type BoxError = Box<dyn std::error::Error + Send + Sync>;
|
||||
|
||||
mod load {
|
||||
pub trait Load {
|
||||
type Metric;
|
||||
fn load(&self) -> Self::Metric;
|
||||
}
|
||||
}
|
||||
|
||||
pub trait Discover {
|
||||
type Key;
|
||||
type Service;
|
||||
type Error;
|
||||
}
|
||||
|
||||
impl<K, S, E, D: ?Sized> Sealed<Change<(), ()>> for D
|
||||
where
|
||||
D: TryStream<Ok = Change<K, S>, Error = E>,
|
||||
K: Eq,
|
||||
{
|
||||
}
|
||||
|
||||
impl<K, S, E, D: ?Sized> Discover for D
|
||||
where
|
||||
D: TryStream<Ok = Change<K, S>, Error = E>,
|
||||
|
|
@ -49,25 +32,5 @@ pub trait MakeService<Target, Request> {
|
|||
type Response;
|
||||
type Error;
|
||||
type Service: Service<Request, Response = Self::Response, Error = Self::Error>;
|
||||
type MakeError;
|
||||
type Future;
|
||||
}
|
||||
|
||||
impl<M, S, Target, Request> Sealed<(Target, Request)> for M
|
||||
where
|
||||
M: Service<Target, Response = S>,
|
||||
S: Service<Request>,
|
||||
{
|
||||
}
|
||||
|
||||
impl<M, S, Target, Request> MakeService<Target, Request> for M
|
||||
where
|
||||
M: Service<Target, Response = S>,
|
||||
S: Service<Request>,
|
||||
{
|
||||
type Response = S::Response;
|
||||
type Error = S::Error;
|
||||
type Service = S;
|
||||
type MakeError = M::Error;
|
||||
type Future = M::Future;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue