pub struct RateLimitConfig {
pub max_requests: u32,
pub window: Duration,
pub retry_after_format: RetryAfterFormat,
}Expand description
Configuration for the rate limiter
Fields§
§max_requests: u32Maximum number of requests allowed within the window
window: DurationTime window for rate limiting
retry_after_format: RetryAfterFormatFormat for Retry-After header (RFC 7231 Date or Seconds)
Implementations§
Source§impl RateLimitConfig
Factory methods for quickly building a rate limiter
impl RateLimitConfig
Factory methods for quickly building a rate limiter
Sourcepub fn max_per_minute(max: u32) -> Self
pub fn max_per_minute(max: u32) -> Self
Build a RateLimitConfig with sensible defaults for requests per minute
Sourcepub fn max_per_window(max_requests: u32, window_seconds: u64) -> Self
pub fn max_per_window(max_requests: u32, window_seconds: u64) -> Self
Build a RateLimitConfig with custom window size in seconds
Trait Implementations§
Source§impl Clone for RateLimitConfig
impl Clone for RateLimitConfig
Source§fn clone(&self) -> RateLimitConfig
fn clone(&self) -> RateLimitConfig
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 RateLimitConfig
impl Debug for RateLimitConfig
Source§impl Default for RateLimitConfig
Sensible (opinionated) defaults
impl Default for RateLimitConfig
Sensible (opinionated) defaults
Source§impl PartialEq for RateLimitConfig
impl PartialEq for RateLimitConfig
impl StructuralPartialEq for RateLimitConfig
Auto Trait Implementations§
impl Freeze for RateLimitConfig
impl RefUnwindSafe for RateLimitConfig
impl Send for RateLimitConfig
impl Sync for RateLimitConfig
impl Unpin for RateLimitConfig
impl UnwindSafe for RateLimitConfig
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