pub struct TriggerIndex { /* private fields */ }Expand description
Index for semantic trigger matching
Implementations§
Source§impl TriggerIndex
impl TriggerIndex
Sourcepub fn register_trigger(
&self,
trigger: SemanticTrigger,
) -> Result<(), TriggerError>
pub fn register_trigger( &self, trigger: SemanticTrigger, ) -> Result<(), TriggerError>
Register a new trigger
Sourcepub fn remove_trigger(&self, trigger_id: &str) -> Option<SemanticTrigger>
pub fn remove_trigger(&self, trigger_id: &str) -> Option<SemanticTrigger>
Remove a trigger
Sourcepub fn set_enabled(&self, trigger_id: &str, enabled: bool) -> bool
pub fn set_enabled(&self, trigger_id: &str, enabled: bool) -> bool
Enable/disable a trigger
Sourcepub fn set_threshold(&self, trigger_id: &str, threshold: f32) -> bool
pub fn set_threshold(&self, trigger_id: &str, threshold: f32) -> bool
Update trigger threshold
Sourcepub fn process_event(&self, event: &TriggerEvent) -> Vec<TriggerMatch>
pub fn process_event(&self, event: &TriggerEvent) -> Vec<TriggerMatch>
Process an event and find matching triggers
Sourcepub fn execute_action(
&self,
trigger_match: &mut TriggerMatch,
) -> Result<(), TriggerError>
pub fn execute_action( &self, trigger_match: &mut TriggerMatch, ) -> Result<(), TriggerError>
Execute action for a trigger match
Sourcepub fn list_triggers(&self) -> Vec<SemanticTrigger>
pub fn list_triggers(&self) -> Vec<SemanticTrigger>
Get all registered triggers
Sourcepub fn get_trigger(&self, trigger_id: &str) -> Option<SemanticTrigger>
pub fn get_trigger(&self, trigger_id: &str) -> Option<SemanticTrigger>
Get trigger by ID
Sourcepub fn recent_matches(&self, limit: usize) -> Vec<TriggerMatch>
pub fn recent_matches(&self, limit: usize) -> Vec<TriggerMatch>
Get recent matches
Sourcepub fn stats(&self) -> TriggerStats
pub fn stats(&self) -> TriggerStats
Get statistics
Sourcepub fn clear_stats(&self)
pub fn clear_stats(&self)
Clear statistics
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for TriggerIndex
impl RefUnwindSafe for TriggerIndex
impl Send for TriggerIndex
impl Sync for TriggerIndex
impl Unpin for TriggerIndex
impl UnsafeUnpin for TriggerIndex
impl UnwindSafe for TriggerIndex
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more