pub struct RateLimitEntry {
pub requests: u32,
pub window: u64,
}Expand description
One (requests, window) rate-limit entry: a per-endpoint or per-country
tier override (the reference endpoint_rate_limits[path] /
geo_rate_limits[country] (int, int) tuples).
Build it with RateLimitEntry::new (fail closed on a zero requests or
window, the reference ge=1 semantics the tier entries inherit from the
flat knobs they override).
Fields§
§requests: u32Maximum requests inside the window.
window: u64The window length in seconds.
Implementations§
Source§impl RateLimitEntry
impl RateLimitEntry
Sourcepub fn new(requests: u32, window: u64) -> Result<Self, RateLimitConfigError>
pub fn new(requests: u32, window: u64) -> Result<Self, RateLimitConfigError>
Validate and build an entry.
§Errors
RateLimitConfigError on a zero requests or window (the
reference rejects both with ge=1).
Trait Implementations§
Source§impl Clone for RateLimitEntry
impl Clone for RateLimitEntry
impl Copy for RateLimitEntry
Source§impl Debug for RateLimitEntry
impl Debug for RateLimitEntry
impl Eq for RateLimitEntry
Source§impl PartialEq for RateLimitEntry
impl PartialEq for RateLimitEntry
impl StructuralPartialEq for RateLimitEntry
Auto Trait Implementations§
impl Freeze for RateLimitEntry
impl RefUnwindSafe for RateLimitEntry
impl Send for RateLimitEntry
impl Sync for RateLimitEntry
impl Unpin for RateLimitEntry
impl UnsafeUnpin for RateLimitEntry
impl UnwindSafe for RateLimitEntry
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.