pub struct Rule {Show 14 fields
pub id: String,
pub trigger: String,
pub action: String,
pub anchor_file: Option<String>,
pub anchor_hash: Option<String>,
pub created: String,
pub last_hit: String,
pub hits: u64,
pub ttl_days: u32,
pub superseded_by: Option<String>,
pub status: RuleStatus,
pub source_session: String,
pub source_event: Option<String>,
pub category: RuleCategory,
}Expand description
A learned rule with TTL decay.
Fields§
§id: String§trigger: String§action: String§anchor_file: Option<String>§anchor_hash: Option<String>§created: String§last_hit: String§hits: u64§ttl_days: u32§superseded_by: Option<String>§status: RuleStatus§source_session: String§source_event: Option<String>§category: RuleCategoryImplementations§
Source§impl Rule
impl Rule
Sourcepub fn is_enforceable(&self) -> bool
pub fn is_enforceable(&self) -> bool
Check if this rule is enforceable (Active status).
Sourcepub fn record_hit(&mut self)
pub fn record_hit(&mut self)
Record a trigger hit: increment counter and reset TTL.
Sourcepub fn days_since_last_hit(&self) -> Option<i64>
pub fn days_since_last_hit(&self) -> Option<i64>
Compute days since last hit.
Sourcepub fn apply_time_decay(&mut self)
pub fn apply_time_decay(&mut self)
Apply time-based decay to this rule’s status.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Rule
impl<'de> Deserialize<'de> for Rule
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Rule
impl RefUnwindSafe for Rule
impl Send for Rule
impl Sync for Rule
impl Unpin for Rule
impl UnsafeUnpin for Rule
impl UnwindSafe for Rule
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