pub struct RateLimitPolicy {
pub max_failures: u32,
pub window: Duration,
pub unavailable: RateLimitUnavailable,
}Expand description
Rate-limit policy (RFC-008 §4).
Fields§
§max_failures: u32Maximum number of recorded failures within window before blocking.
window: DurationRolling window over which failures are counted.
What to do when the rate-limit store is unreachable.
Implementations§
Source§impl RateLimitPolicy
impl RateLimitPolicy
Sourcepub fn default_invite() -> Self
pub fn default_invite() -> Self
Sensible default: 10 failures in 5 minutes, fail-open.
Matches the source service’s 10 failures / 5 min / IP policy.
Sourcepub fn is_exceeded(&self, failures: u32) -> bool
pub fn is_exceeded(&self, failures: u32) -> bool
Whether a given failure count is at or over the threshold.
Trait Implementations§
Source§impl Clone for RateLimitPolicy
impl Clone for RateLimitPolicy
Source§fn clone(&self) -> RateLimitPolicy
fn clone(&self) -> RateLimitPolicy
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 RateLimitPolicy
impl RefUnwindSafe for RateLimitPolicy
impl Send for RateLimitPolicy
impl Sync for RateLimitPolicy
impl Unpin for RateLimitPolicy
impl UnsafeUnpin for RateLimitPolicy
impl UnwindSafe for RateLimitPolicy
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