From 22d798bb53e17cec89fcb04d967d1791272d8311 Mon Sep 17 00:00:00 2001
From: Nilstrieb <48135649+Nilstrieb@users.noreply.github.com>
Date: Thu, 15 Sep 2022 22:45:03 +0200
Subject: [PATCH] yeah
---
tower/src/lib.rs | 45 ++++++++++++++++++++-------------------------
1 file changed, 20 insertions(+), 25 deletions(-)
diff --git a/tower/src/lib.rs b/tower/src/lib.rs
index 11358d5..65df4f6 100644
--- a/tower/src/lib.rs
+++ b/tower/src/lib.rs
@@ -9,7 +9,7 @@ pub trait Stream {
impl
Stream for Pin
where
- P: DerefMut + Unpin,
+ P: DerefMut,
P::Target: Stream,
{
type Item = ::Item;
@@ -29,9 +29,7 @@ where
pub type BoxError = ();
pub trait Discover {
- type Key;
type Service;
- type Error;
}
impl Discover for D
@@ -39,9 +37,7 @@ where
D: TryStream,
K: Eq,
{
- type Key = K;
type Service = S;
- type Error = ();
}
pub trait Service {
@@ -49,7 +45,7 @@ pub trait Service {
type Future;
}
-pub trait MakeService {
+pub trait MakeService {
type Response;
type Error;
type Service: Service;
@@ -76,54 +72,53 @@ impl Service for Balance {
type Future = std::future::Ready<()>;
}
-pub struct PoolDiscoverer
+pub struct PoolDiscoverer
where
- MS: MakeService,
+ MS: MakeService,
{
- _p: PhantomData<(MS, Target, Request)>,
+ _p: PhantomData<(MS, Request)>,
}
-impl Stream for PoolDiscoverer
+impl Stream for PoolDiscoverer
where
- MS: MakeService,
+ MS: MakeService,
{
- type Item = (usize, DropNotifyService);
+ type Item = (usize, SvcWrap);
}
pub struct Builder {}
impl Builder {
- pub fn build()
+ pub fn build()
where
- MS: MakeService,
+ MS: MakeService,
MS::Error: Into,
{
- let d: PoolDiscoverer = todo!();
+ let d: PoolDiscoverer = todo!();
// THE CRITICAL STATEMENT
- let _ = Balance::new(Box::pin(d));
+ let _ = Balance::new(Box::pin(d));
}
}
-pub struct Pool {
- balance: (MS, Target, Request),
+pub struct Pool {
+ balance: (MS, Request),
}
-impl Service for Pool
+impl Service for Pool
where
- MS: MakeService,
+ MS: MakeService,
MS::Error: Into,
- Target: Clone,
{
- type Error = , Req> as Service>::Error;
- type Future = , Req> as Service>::Future;
+ type Error = , Req> as Service>::Error;
+ type Future = , Req> as Service>::Future;
}
-pub struct DropNotifyService {
+pub struct SvcWrap {
svc: Svc,
}
-impl> Service for DropNotifyService {
+impl> Service for SvcWrap {
type Future = Svc::Future;
type Error = Svc::Error;
}