pub trait RateLimiter {
// Required method
fn wait_until_ready(&mut self) -> impl Future<Output = ()> + Send;
}
Expand description
A per-call rate limiter, where each call has an implied cost of 1 permit.
See SlidingWindowRateLimiter
for a common use case.
Required Methods§
fn wait_until_ready(&mut self) -> impl Future<Output = ()> + Send
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementors§
impl<L: ThreadsafeRateLimiter> RateLimiter for L
All RateLimiter
s are ThreadsafeRateLimiter
s, since they can pass &mut self
as &self
.
This blanket implementation saves implementers from having to define the trait manually.