From 28b397587e34c41d367faea822c85ff65bc7beee Mon Sep 17 00:00:00 2001 From: Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> Date: Thu, 15 Sep 2022 22:22:33 +0200 Subject: [PATCH] remove bounds --- tower/src/balance.rs | 21 ++------------------- tower/src/lib.rs | 37 ------------------------------------- 2 files changed, 2 insertions(+), 56 deletions(-) diff --git a/tower/src/balance.rs b/tower/src/balance.rs index fe720e8..a74fbae 100644 --- a/tower/src/balance.rs +++ b/tower/src/balance.rs @@ -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, - D::Service: Service + Load, - ::Metric: std::fmt::Debug, + D::Service: Service, >::Error: Into, { type Response = >::Response; @@ -54,7 +52,7 @@ impl Stream for PoolDiscoverer where MS: MakeService, { - type Item = Result>, MS::MakeError>; + type Item = Result>, MS::Error>; fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { todo!() @@ -67,9 +65,6 @@ impl Builder { pub fn build() -> () where MS: MakeService, - MS::Service: Load, - ::Metric: std::fmt::Debug, - MS::MakeError: Into, MS::Error: Into, { let d: PoolDiscoverer = todo!(); @@ -90,11 +85,7 @@ type PinBalance = Balance>, Request>; impl Service for Pool where MS: MakeService, - MS::Service: Load, - ::Metric: std::fmt::Debug, - MS::MakeError: Into, MS::Error: Into, - Target: Clone, { type Response = , Req> as Service>::Response; type Error = , Req> as Service>::Error; @@ -105,14 +96,6 @@ pub struct DropNotifyService { svc: Svc, } - -impl Load for DropNotifyService { - type Metric = Svc::Metric; - fn load(&self) -> Self::Metric { - todo!() - } -} - impl> Service for DropNotifyService { type Response = Svc::Response; type Future = Svc::Future; diff --git a/tower/src/lib.rs b/tower/src/lib.rs index 769ec9a..80e4a88 100644 --- a/tower/src/lib.rs +++ b/tower/src/lib.rs @@ -1,32 +1,15 @@ pub mod balance; use futures_core::TryStream; -use std::future::Future; -pub trait Sealed {} -/// Alias for a type-erased error type. pub type BoxError = Box; -mod load { - pub trait Load { - type Metric; - fn load(&self) -> Self::Metric; - } -} - pub trait Discover { type Key; type Service; type Error; } -impl Sealed> for D -where - D: TryStream, Error = E>, - K: Eq, -{ -} - impl Discover for D where D: TryStream, Error = E>, @@ -49,25 +32,5 @@ pub trait MakeService { type Response; type Error; type Service: Service; - type MakeError; type Future; } - -impl Sealed<(Target, Request)> for M -where - M: Service, - S: Service, -{ -} - -impl MakeService for M -where - M: Service, - S: Service, -{ - type Response = S::Response; - type Error = S::Error; - type Service = S; - type MakeError = M::Error; - type Future = M::Future; -}