pub struct LimitParams { /* private fields */ }Expand description
Configuration parameters for rate limiting middleware
Implementations§
Source§impl LimitParams
impl LimitParams
Sourcepub fn new(max: i64) -> Self
pub fn new(max: i64) -> Self
Creates a new LimitParams with the maximum number of requests allowed. Defaults to IP-based limiting with no category and a 5-minute TTL.
Sourcepub fn with_category(self, category: impl Into<String>) -> Self
pub fn with_category(self, category: impl Into<String>) -> Self
Sets the category identifier used as a prefix in the cache key.
Sourcepub fn with_limit_type(self, limit_type: LimitType) -> Self
pub fn with_limit_type(self, limit_type: LimitType) -> Self
Sets the limit type (IP-based or header-based).
Trait Implementations§
Source§impl Clone for LimitParams
impl Clone for LimitParams
Source§fn clone(&self) -> LimitParams
fn clone(&self) -> LimitParams
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 moreSource§impl Debug for LimitParams
impl Debug for LimitParams
Source§impl Default for LimitParams
impl Default for LimitParams
Source§fn default() -> LimitParams
fn default() -> LimitParams
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for LimitParams
impl RefUnwindSafe for LimitParams
impl Send for LimitParams
impl Sync for LimitParams
impl Unpin for LimitParams
impl UnsafeUnpin for LimitParams
impl UnwindSafe for LimitParams
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