pub struct Topic(/* private fields */);Expand description
A topic for event routing.
Topics can be either concrete (e.g., impl.done) or patterns (e.g., impl.*).
Implementations§
Source§impl Topic
impl Topic
Sourcepub fn is_global_wildcard(&self) -> bool
pub fn is_global_wildcard(&self) -> bool
Returns true if this is a global wildcard (*) that matches everything.
Used for fallback routing - global wildcards have lower priority than specific subscriptions.
Sourcepub fn matches(&self, topic: &Topic) -> bool
pub fn matches(&self, topic: &Topic) -> bool
Checks if this topic pattern matches a given topic.
Pattern rules:
*matches any single segment (e.g.,impl.*matchesimpl.done)- Exact match for non-pattern topics
- A single
*matches everything
Sourcepub fn matches_str(&self, target: &str) -> bool
pub fn matches_str(&self, target: &str) -> bool
Checks if this topic pattern matches a given topic string.
Zero-allocation variant of matches() for hot paths.
Avoids creating a temporary Topic wrapper.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Topic
impl<'de> Deserialize<'de> for Topic
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
impl Eq for Topic
impl StructuralPartialEq for Topic
Auto Trait Implementations§
impl Freeze for Topic
impl RefUnwindSafe for Topic
impl Send for Topic
impl Sync for Topic
impl Unpin for Topic
impl UnsafeUnpin for Topic
impl UnwindSafe for Topic
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