pub trait ThreadsafeVariableRateLimiter {
// Required method
fn wait_with_cost(&self, cost: usize) -> impl Future<Output = ()> + Send;
}
Expand description
A threadsafe cost-based rate limiter, where each call can be of a variable cost.
Calls that cost more than all potentially available permits WILL deadlock permanently.
See TokenBucketRateLimiter
for a common use case.
Required Methods§
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.