pub struct RateLimitConfig { /* private fields */ }Expand description
Typed config for production-shaped rate limiting.
Implementations§
Source§impl RateLimitConfig
impl RateLimitConfig
Sourcepub fn new(limit: u64, window: Duration, store: impl RateLimitStore) -> Self
pub fn new(limit: u64, window: Duration, store: impl RateLimitStore) -> Self
Creates a rate-limit config with an explicit store.
Sourcepub fn identity(self, extractor: impl IdentityExtractor) -> Self
pub fn identity(self, extractor: impl IdentityExtractor) -> Self
Replaces the identity extractor.
Sourcepub fn fail_closed(self) -> Self
pub fn fail_closed(self) -> Self
Rejects requests when the backing store fails.
Sourcepub fn layer(self) -> RateLimitLayer
pub fn layer(self) -> RateLimitLayer
Creates a Tower layer from this config.
Trait Implementations§
Source§impl Clone for RateLimitConfig
impl Clone for RateLimitConfig
Source§fn clone(&self) -> RateLimitConfig
fn clone(&self) -> RateLimitConfig
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 moreAuto Trait Implementations§
impl !RefUnwindSafe for RateLimitConfig
impl !UnwindSafe for RateLimitConfig
impl Freeze for RateLimitConfig
impl Send for RateLimitConfig
impl Sync for RateLimitConfig
impl Unpin for RateLimitConfig
impl UnsafeUnpin for RateLimitConfig
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