pub struct RuleSet { /* private fields */ }Expand description
规则集
Implementations§
Source§impl RuleSet
impl RuleSet
Sourcepub fn add(&mut self, rule: RateLimitRule) -> &mut Self
pub fn add(&mut self, rule: RateLimitRule) -> &mut Self
添加规则
Sourcepub fn find_matches(&self, key: &str) -> Vec<&RateLimitRule>
pub fn find_matches(&self, key: &str) -> Vec<&RateLimitRule>
查找匹配的规则
Sourcepub fn rule_count(&self) -> usize
pub fn rule_count(&self) -> usize
规则数量
Sourcepub fn enabled_count(&self) -> usize
pub fn enabled_count(&self) -> usize
启用的规则数
Sourcepub fn find_by_prefix(&self, prefix: &str) -> Option<&RateLimitRule>
pub fn find_by_prefix(&self, prefix: &str) -> Option<&RateLimitRule>
按前缀查找
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RuleSet
impl RefUnwindSafe for RuleSet
impl Send for RuleSet
impl Sync for RuleSet
impl Unpin for RuleSet
impl UnsafeUnpin for RuleSet
impl UnwindSafe for RuleSet
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