pub struct RateLimitBuilder { /* private fields */ }Expand description
Builder for endpoint-specific rate limits.
Implementations§
Source§impl RateLimitBuilder
impl RateLimitBuilder
Sourcepub fn new() -> RateLimitBuilder
pub fn new() -> RateLimitBuilder
Create a new rate limit builder.
Sourcepub fn add_rule(
self,
pattern: &str,
config: RateLimitConfig,
) -> RateLimitBuilder
pub fn add_rule( self, pattern: &str, config: RateLimitConfig, ) -> RateLimitBuilder
Add a rate limit rule for a path pattern.
Sourcepub fn default_limit(self, config: RateLimitConfig) -> RateLimitBuilder
pub fn default_limit(self, config: RateLimitConfig) -> RateLimitBuilder
Set the default rate limit for unmatched paths.
Sourcepub fn protect_login(self, path: &str) -> RateLimitBuilder
pub fn protect_login(self, path: &str) -> RateLimitBuilder
Add strict rate limiting for login endpoints.
Sourcepub fn protect_api(self, path: &str) -> RateLimitBuilder
pub fn protect_api(self, path: &str) -> RateLimitBuilder
Add lenient rate limiting for API endpoints.
Trait Implementations§
Source§impl Clone for RateLimitBuilder
impl Clone for RateLimitBuilder
Source§fn clone(&self) -> RateLimitBuilder
fn clone(&self) -> RateLimitBuilder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for RateLimitBuilder
impl Default for RateLimitBuilder
Source§fn default() -> RateLimitBuilder
fn default() -> RateLimitBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for RateLimitBuilder
impl !RefUnwindSafe for RateLimitBuilder
impl Send for RateLimitBuilder
impl Sync for RateLimitBuilder
impl Unpin for RateLimitBuilder
impl !UnwindSafe for RateLimitBuilder
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<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more