pub struct InMemoryRuleStorage { /* private fields */ }Expand description
内存规则存储。
使用 RwLock<Vec<TriggerRule>> 存储规则,添加时按 priority 排序。
Implementations§
Trait Implementations§
Source§impl Default for InMemoryRuleStorage
impl Default for InMemoryRuleStorage
Source§impl RuleStorage for InMemoryRuleStorage
impl RuleStorage for InMemoryRuleStorage
Source§fn add(&self, rule: TriggerRule)
fn add(&self, rule: TriggerRule)
添加一条规则。
Source§fn update(&self, rule: TriggerRule) -> bool
fn update(&self, rule: TriggerRule) -> bool
更新一条规则(根据 rule.id 查找并替换)。返回是否成功。
Source§fn list(&self) -> Vec<TriggerRule>
fn list(&self) -> Vec<TriggerRule>
获取所有规则(按 priority 排序)。
Auto Trait Implementations§
impl !Freeze for InMemoryRuleStorage
impl RefUnwindSafe for InMemoryRuleStorage
impl Send for InMemoryRuleStorage
impl Sync for InMemoryRuleStorage
impl Unpin for InMemoryRuleStorage
impl UnsafeUnpin for InMemoryRuleStorage
impl UnwindSafe for InMemoryRuleStorage
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