pub struct AdvancedRateLimiter { /* private fields */ }
Expand description
A more advanced rate limiter that supports different rate limiting strategies.
Implementations§
Source§impl AdvancedRateLimiter
impl AdvancedRateLimiter
Sourcepub fn new(
requests_per_second: f64,
check_every_n_seconds: f64,
max_bucket_size: f64,
config: RateLimiterConfig,
) -> Self
pub fn new( requests_per_second: f64, check_every_n_seconds: f64, max_bucket_size: f64, config: RateLimiterConfig, ) -> Self
Create a new advanced rate limiter
Sourcepub async fn acquire_with_retry(&self, blocking: bool) -> Result<bool>
pub async fn acquire_with_retry(&self, blocking: bool) -> Result<bool>
Acquire with retry logic and exponential backoff
Sourcepub fn config(&self) -> &RateLimiterConfig
pub fn config(&self) -> &RateLimiterConfig
Get the current configuration
Sourcepub fn update_config(&mut self, config: RateLimiterConfig)
pub fn update_config(&mut self, config: RateLimiterConfig)
Update the configuration
Trait Implementations§
Source§impl BaseRateLimiter for AdvancedRateLimiter
impl BaseRateLimiter for AdvancedRateLimiter
Source§impl Clone for AdvancedRateLimiter
impl Clone for AdvancedRateLimiter
Source§fn clone(&self) -> AdvancedRateLimiter
fn clone(&self) -> AdvancedRateLimiter
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for AdvancedRateLimiter
impl !RefUnwindSafe for AdvancedRateLimiter
impl Send for AdvancedRateLimiter
impl Sync for AdvancedRateLimiter
impl Unpin for AdvancedRateLimiter
impl !UnwindSafe for AdvancedRateLimiter
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