limit: Forward tower_load::Load (#429)

This commit is contained in:
Jon Gjengset 2020-03-25 19:46:05 -04:00 committed by GitHub
parent b575175210
commit 378433fc75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 0 deletions

View File

@ -25,6 +25,7 @@ edition = "2018"
futures-core = { version = "0.3", default-features = false }
tower-service = "0.3"
tower-layer = "0.3"
tower-load = "0.3"
tokio = { version = "0.2", features = ["time"] }
pin-project = "0.4"

View File

@ -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>
where
S: Clone,

View File

@ -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()
}
}