pub struct RouteRateLimits { /* private fields */ }Expand description
The route decorator’s rate-limit tier overrides
(RouteConfig.rate_limit / rate_limit_window / geo_rate_limits).
Build it with RouteRateLimits::new; the geo tier’s country entries
are RateLimitEntry values (already validated). The geo country key
set mirrors the reference: exact country codes with the "*"
fallback entry, compared exactly (no case folding, the reference reads
the resolved country as-is).
Implementations§
Source§impl RouteRateLimits
impl RouteRateLimits
Sourcepub fn new(
rate_limit: Option<u32>,
rate_limit_window: Option<u64>,
geo_rate_limits: Option<HashMap<String, RateLimitEntry>>,
) -> Result<Self, RateLimitConfigError>
pub fn new( rate_limit: Option<u32>, rate_limit_window: Option<u64>, geo_rate_limits: Option<HashMap<String, RateLimitEntry>>, ) -> Result<Self, RateLimitConfigError>
Validate and build the route tier overrides.
§Errors
RateLimitConfigError on a zero rate_limit or a zero
rate_limit_window that a configured route tier would run under
(the reference ge=1 semantics); a None rate limit with a window
is inert and therefore not rejected, mirroring the reference where
rate_limit_window alone never configures a tier.
Sourcepub const fn rate_limit(&self) -> Option<u32>
pub const fn rate_limit(&self) -> Option<u32>
route_config.rate_limit.
Sourcepub const fn rate_limit_window(&self) -> Option<u64>
pub const fn rate_limit_window(&self) -> Option<u64>
route_config.rate_limit_window (the reference default of 60
applies when a route tier runs and this is None).
Sourcepub const fn geo_rate_limits(&self) -> Option<&HashMap<String, RateLimitEntry>>
pub const fn geo_rate_limits(&self) -> Option<&HashMap<String, RateLimitEntry>>
route_config.geo_rate_limits.
Trait Implementations§
Source§impl Clone for RouteRateLimits
impl Clone for RouteRateLimits
Source§impl Debug for RouteRateLimits
impl Debug for RouteRateLimits
Source§impl Default for RouteRateLimits
impl Default for RouteRateLimits
impl Eq for RouteRateLimits
Source§impl PartialEq for RouteRateLimits
impl PartialEq for RouteRateLimits
impl StructuralPartialEq for RouteRateLimits
Auto Trait Implementations§
impl Freeze for RouteRateLimits
impl RefUnwindSafe for RouteRateLimits
impl Send for RouteRateLimits
impl Sync for RouteRateLimits
impl Unpin for RouteRateLimits
impl UnsafeUnpin for RouteRateLimits
impl UnwindSafe for RouteRateLimits
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
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
key and return true if they are equal.