pub struct RateLimiterRegistry { /* private fields */ }Expand description
Per-provider rate limiter registry
Implementations§
Source§impl RateLimiterRegistry
impl RateLimiterRegistry
Sourcepub fn register(&self, provider_id: &str, limiter: TokenBucketLimiter)
pub fn register(&self, provider_id: &str, limiter: TokenBucketLimiter)
Register a rate limiter for a provider
Sourcepub fn get_or_create(&self, provider_id: &str) -> Arc<Mutex<TokenBucketLimiter>>
pub fn get_or_create(&self, provider_id: &str) -> Arc<Mutex<TokenBucketLimiter>>
Get or create a rate limiter for a provider
Sourcepub fn try_acquire(&self, provider_id: &str, tokens: f64) -> bool
pub fn try_acquire(&self, provider_id: &str, tokens: f64) -> bool
Try to acquire tokens for a provider
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RateLimiterRegistry
impl RefUnwindSafe for RateLimiterRegistry
impl Send for RateLimiterRegistry
impl Sync for RateLimiterRegistry
impl Unpin for RateLimiterRegistry
impl UnwindSafe for RateLimiterRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more