pub struct TopicMatcher { /* private fields */ }Expand description
Compiled topic-pattern matcher. Mirrors the segment-aware matching
semantics of EventReceiver::matches so the broadcast and routed
paths agree on what each pattern means.
Implementations§
Source§impl TopicMatcher
impl TopicMatcher
Sourcepub const MAX_TOPIC_DEPTH: usize = 20
pub const MAX_TOPIC_DEPTH: usize = 20
Maximum allowed topic depth (dot-separated segments). Matches the bus-level cap.
Sourcepub fn new(pattern: impl Into<String>) -> Self
pub fn new(pattern: impl Into<String>) -> Self
Compile a topic pattern. The pattern follows the same grammar as
subscribe_topic_as: exact match, trailing * for namespace
match, mid-segment * for single-segment wildcard.
Sourcepub fn matches(&self, event: &AstridEvent) -> bool
pub fn matches(&self, event: &AstridEvent) -> bool
True iff the event matches this pattern. Non-IPC events never match a routed pattern.
Sourcepub fn matches_topic(&self, topic: &str) -> bool
pub fn matches_topic(&self, topic: &str) -> bool
True iff topic matches this pattern. Thin wrapper over the shared,
allocation-free topic_pattern_matches.
Trait Implementations§
Source§impl Clone for TopicMatcher
impl Clone for TopicMatcher
Source§fn clone(&self) -> TopicMatcher
fn clone(&self) -> TopicMatcher
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 TopicMatcher
impl RefUnwindSafe for TopicMatcher
impl Send for TopicMatcher
impl Sync for TopicMatcher
impl Unpin for TopicMatcher
impl UnsafeUnpin for TopicMatcher
impl UnwindSafe for TopicMatcher
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