pub trait PatternDetector: Send + Sync {
// Required methods
fn check(
&self,
state: &State,
event: Option<&SessionEvent>,
now: Instant,
) -> bool;
fn reset(&self);
// Provided method
fn needs_timer(&self) -> bool { ... }
}Expand description
A detector that evaluates whether a temporal pattern has been triggered.
Implementations track internal state (timestamps, counters) to decide
when a pattern fires. All interior mutability is handled via atomic
operations or parking_lot locks so that &self suffices.
Required Methods§
Provided Methods§
Sourcefn needs_timer(&self) -> bool
fn needs_timer(&self) -> bool
Whether this detector requires periodic timer checks.
Detectors that depend on elapsed time (e.g. SustainedDetector)
should return true so the runtime can schedule a timer.