pub struct EventMatcher { /* private fields */ }Expand description
Compiled event matcher
Created from a TriggerConfig, provides zero-allocation matching
via enum dispatch instead of string comparisons.
Implementations§
Source§impl EventMatcher
impl EventMatcher
Sourcepub fn compile(config: &TriggerConfig) -> Result<Self, UnknownEventKind>
pub fn compile(config: &TriggerConfig) -> Result<Self, UnknownEventKind>
Compile a TriggerConfig into an EventMatcher
Returns an error if the kind string is not recognized.
§Examples
use this::config::events::TriggerConfig;
use this::events::matcher::EventMatcher;
let config = TriggerConfig {
kind: "link.created".to_string(),
link_type: Some("follows".to_string()),
entity_type: None,
};
let matcher = EventMatcher::compile(&config).unwrap();Sourcepub fn matches(&self, event: &FrameworkEvent) -> bool
pub fn matches(&self, event: &FrameworkEvent) -> bool
Check whether a framework event matches this matcher
Returns true if:
- The event kind matches (e.g., link.created)
- Any type filters match (link_type or entity_type)
When a filter is None, it’s treated as a wildcard (always matches).
Trait Implementations§
Source§impl Clone for EventMatcher
impl Clone for EventMatcher
Source§fn clone(&self) -> EventMatcher
fn clone(&self) -> EventMatcher
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for EventMatcher
impl RefUnwindSafe for EventMatcher
impl Send for EventMatcher
impl Sync for EventMatcher
impl Unpin for EventMatcher
impl UnsafeUnpin for EventMatcher
impl UnwindSafe for EventMatcher
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