pub struct RateLimitConfig {
pub max_requests: u32,
pub window_duration: Duration,
}Expand description
Configuration for rate limiting per IP address.
Controls how many requests a single IP can make within a time window.
§Example
use std::time::Duration;
use wisegate_core::RateLimitConfig;
let config = RateLimitConfig {
max_requests: 100,
window_duration: Duration::from_secs(60),
};
assert!(config.is_valid());Fields§
§max_requests: u32Maximum number of requests allowed per IP within the window
window_duration: DurationDuration of the sliding window for rate limiting
Implementations§
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 moreAuto Trait Implementations§
impl Freeze for RateLimitConfig
impl RefUnwindSafe for RateLimitConfig
impl Send for RateLimitConfig
impl Sync for RateLimitConfig
impl Unpin for RateLimitConfig
impl UnsafeUnpin 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