pub struct RateLimitDecision {
pub allowed: bool,
pub count: u64,
pub window: u64,
}Expand description
The outcome of one rate-limit check.
Fields§
§allowed: boolfalse when the request crossed the limit and must be answered with
the family’s 429 Too many requests carrying
RateLimitDecision::retry_after.
count: u64Requests observed inside the window including this one (the count both references report when they block).
window: u64The window length the decision was made under (seconds), so callers
can render Retry-After without re-reading the config.
Implementations§
Source§impl RateLimitDecision
impl RateLimitDecision
Sourcepub const fn retry_after(self) -> u64
pub const fn retry_after(self) -> u64
The Retry-After header value for a blocked request: the window
length, exactly what the reference sets.
Trait Implementations§
Source§impl Clone for RateLimitDecision
impl Clone for RateLimitDecision
impl Copy for RateLimitDecision
Source§impl Debug for RateLimitDecision
impl Debug for RateLimitDecision
impl Eq for RateLimitDecision
Source§impl PartialEq for RateLimitDecision
impl PartialEq for RateLimitDecision
impl StructuralPartialEq for RateLimitDecision
Auto Trait Implementations§
impl Freeze for RateLimitDecision
impl RefUnwindSafe for RateLimitDecision
impl Send for RateLimitDecision
impl Sync for RateLimitDecision
impl Unpin for RateLimitDecision
impl UnsafeUnpin for RateLimitDecision
impl UnwindSafe for RateLimitDecision
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.