struct GovernorLayer;
impl<K, M, S> Layer<S> for GovernorLayer
where
K: KeyExtractor,
M: RateLimitingMiddleware<QuantaInstant>,
{
type Service = Governor<K, M, S>;
fn layer(&self, inner: S, config: &GovernorConfig<K, M>) -> Self::Service {
Service::new(inner, config)
}
}
Trying to implement a layer for Axum on the middleware, but I'm getting an interesting error:
the type parameter `M` is not constrained by the impl trait, self type, or predicates
unconstrained type parameter
I get the same error for K. What am I missing ? How do I constrain K and M?