when I add tower::limit::RateLimitLayer in the route_layer, it shows the trait bound tower::limit::RateLimit<Route<_>>: Clone
is not satisfied the trait Clone
is not implemented for tower::limit::RateLimit<Route<_>>
.
#877
-
Versionaxum = "0.4.8" Platformlinux ubuntu 21.10 Descriptionwhen I use this method to add route_layer, it show follow error: use tower::limit::{ConcurrencyLimitLayer, RateLimitLayer};
Router::new()
.route("/", get(health))
.route("/v1/signup", post(signup).route_layer(RateLimitLayer::new(1000, std::time::Duration::from_secs(1)))) but, when I replace |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Well the compile error has all the info. Services used with axum must be |
Beta Was this translation helpful? Give feedback.
Well the compile error has all the info. Services used with axum must be
Clone
whichRateLimit
isn't. I'm not familiar with howRateLimit
so can't say why that is. You can combine it withBufferLayer
to make itClone
.