limit: Forward tower_load::Load (#429)
This commit is contained in:
parent
b575175210
commit
378433fc75
|
@ -25,6 +25,7 @@ edition = "2018"
|
||||||
futures-core = { version = "0.3", default-features = false }
|
futures-core = { version = "0.3", default-features = false }
|
||||||
tower-service = "0.3"
|
tower-service = "0.3"
|
||||||
tower-layer = "0.3"
|
tower-layer = "0.3"
|
||||||
|
tower-load = "0.3"
|
||||||
tokio = { version = "0.2", features = ["time"] }
|
tokio = { version = "0.2", features = ["time"] }
|
||||||
pin-project = "0.4"
|
pin-project = "0.4"
|
||||||
|
|
||||||
|
|
|
@ -86,6 +86,16 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<S> tower_load::Load for ConcurrencyLimit<S>
|
||||||
|
where
|
||||||
|
S: tower_load::Load,
|
||||||
|
{
|
||||||
|
type Metric = S::Metric;
|
||||||
|
fn load(&self) -> Self::Metric {
|
||||||
|
self.inner.load()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<S> Clone for ConcurrencyLimit<S>
|
impl<S> Clone for ConcurrencyLimit<S>
|
||||||
where
|
where
|
||||||
S: Clone,
|
S: Clone,
|
||||||
|
|
|
@ -108,3 +108,13 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<S> tower_load::Load for RateLimit<S>
|
||||||
|
where
|
||||||
|
S: tower_load::Load,
|
||||||
|
{
|
||||||
|
type Metric = S::Metric;
|
||||||
|
fn load(&self) -> Self::Metric {
|
||||||
|
self.inner.load()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue