pub struct LimiterConfig {
pub default_rule: RuleConfig,
pub route_rules: HashMap<String, RuleConfig>,
pub max_memory: usize,
pub gc_interval: u64,
}
Expand description
Configuration for the rate limiter
Fields§
§default_rule: RuleConfig
§route_rules: HashMap<String, RuleConfig>
§max_memory: usize
§gc_interval: u64
Implementations§
Source§impl LimiterConfig
impl LimiterConfig
pub fn new(default_rule: RuleConfig) -> Self
pub fn add_route_rule(self, route: &str, rule: RuleConfig) -> Self
pub fn with_max_memory(self, max_memory: usize) -> Self
pub fn with_gc_interval(self, gc_interval: u64) -> Self
pub fn max_interval(&self) -> Duration
pub fn get_rule_for_route(&self, route: &str) -> &RuleConfig
pub fn has_route_rule(&self, route: &str) -> bool
Trait Implementations§
Source§impl Clone for LimiterConfig
impl Clone for LimiterConfig
Source§fn clone(&self) -> LimiterConfig
fn clone(&self) -> LimiterConfig
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 moreAuto Trait Implementations§
impl Freeze for LimiterConfig
impl RefUnwindSafe for LimiterConfig
impl Send for LimiterConfig
impl Sync for LimiterConfig
impl Unpin for LimiterConfig
impl UnwindSafe for LimiterConfig
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