pub struct RateLimiterConfig {
pub requests_per_second: f64,
pub burst_capacity: usize,
}Expand description
Rate limiter configuration using GCRA algorithm
Fields§
§requests_per_second: f64Requests allowed per second
burst_capacity: usizeBurst capacity (number of requests that can be made instantly)
Implementations§
Source§impl RateLimiterConfig
impl RateLimiterConfig
Sourcepub fn new(requests_per_second: f64, burst_capacity: usize) -> Self
pub fn new(requests_per_second: f64, burst_capacity: usize) -> Self
Create a new rate limiter configuration
Sourcepub fn emission_interval(&self) -> f64
pub fn emission_interval(&self) -> f64
Calculate GCRA emission interval (time between requests)
Sourcepub fn delay_tolerance(&self) -> f64
pub fn delay_tolerance(&self) -> f64
Calculate GCRA delay tolerance (for burst support)
Trait Implementations§
Source§impl Clone for RateLimiterConfig
impl Clone for RateLimiterConfig
Source§fn clone(&self) -> RateLimiterConfig
fn clone(&self) -> RateLimiterConfig
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 moreSource§impl Debug for RateLimiterConfig
impl Debug for RateLimiterConfig
Auto Trait Implementations§
impl Freeze for RateLimiterConfig
impl RefUnwindSafe for RateLimiterConfig
impl Send for RateLimiterConfig
impl Sync for RateLimiterConfig
impl Unpin for RateLimiterConfig
impl UnwindSafe for RateLimiterConfig
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