pub struct RateLimitOptions {
pub enabled: Option<bool>,
pub window: u64,
pub max: u64,
pub storage: RateLimitStorageOption,
pub custom_rules: Vec<RateLimitPathRule>,
pub dynamic_rules: Vec<DynamicRateLimitPathRule>,
pub custom_store: Option<Arc<dyn RateLimitStore>>,
pub custom_storage: Option<Arc<dyn RateLimitStorage>>,
pub hybrid: HybridRateLimitOptions,
pub memory_cleanup_interval: Option<Duration>,
}Expand description
Rate limiting defaults.
Fields§
§enabled: Option<bool>§window: u64§max: u64§storage: RateLimitStorageOption§custom_rules: Vec<RateLimitPathRule>§dynamic_rules: Vec<DynamicRateLimitPathRule>§custom_store: Option<Arc<dyn RateLimitStore>>§custom_storage: Option<Arc<dyn RateLimitStorage>>§hybrid: HybridRateLimitOptions§memory_cleanup_interval: Option<Duration>Implementations§
Source§impl RateLimitOptions
impl RateLimitOptions
pub fn new() -> Self
pub fn builder() -> Self
pub fn memory() -> Self
pub fn database<S>(store: S) -> Selfwhere
S: RateLimitStore,
pub fn database_arc(store: Arc<dyn RateLimitStore>) -> Self
pub fn secondary_storage<S>(store: S) -> Selfwhere
S: RateLimitStore,
pub fn secondary_storage_arc(store: Arc<dyn RateLimitStore>) -> Self
pub fn enabled(self, enabled: bool) -> Self
pub fn window(self, window: u64) -> Self
pub fn max(self, max: u64) -> Self
pub fn storage(self, storage: RateLimitStorageOption) -> Self
pub fn custom_store<S>(self, store: S) -> Selfwhere
S: RateLimitStore,
pub fn custom_store_arc(self, store: Arc<dyn RateLimitStore>) -> Self
pub fn custom_storage(self, storage: Arc<dyn RateLimitStorage>) -> Self
pub fn custom_rule(self, path: impl Into<String>, rule: RateLimitRule) -> Self
pub fn disabled_path(self, path: impl Into<String>) -> Self
pub fn dynamic_rule<P>(self, path: impl Into<String>, provider: P) -> Selfwhere
P: RateLimitRuleProvider,
pub fn hybrid(self, hybrid: HybridRateLimitOptions) -> Self
pub fn memory_cleanup_interval(self, interval: Option<Duration>) -> Self
Trait Implementations§
Source§impl Clone for RateLimitOptions
impl Clone for RateLimitOptions
Source§fn clone(&self) -> RateLimitOptions
fn clone(&self) -> RateLimitOptions
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 RateLimitOptions
impl Debug for RateLimitOptions
Auto Trait Implementations§
impl Freeze for RateLimitOptions
impl !RefUnwindSafe for RateLimitOptions
impl Send for RateLimitOptions
impl Sync for RateLimitOptions
impl Unpin for RateLimitOptions
impl UnsafeUnpin for RateLimitOptions
impl !UnwindSafe for RateLimitOptions
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