pub struct TopicMatch { /* private fields */ }Expand description
The result of matching a TopicPath against a pattern.
Holds the matched topic plus the ranges of segments captured by the
pattern’s wildcards, accessible by position (get_param)
or by name (get_named_param).
Clone is cheap: an Arc bump for the shared path plus two small inline
vectors of segment ranges (no re-parsing, no string copies).
Implementations§
Source§impl TopicMatch
impl TopicMatch
Sourcepub fn path_segments(&self) -> &Vec<Substr>
pub fn path_segments(&self) -> &Vec<Substr>
Returns the matched topic’s segments.
Sourcepub fn get_param(&self, index: usize) -> Option<Substr>
pub fn get_param(&self, index: usize) -> Option<Substr>
Returns the positional parameter captured at index, if any.
Parameters are numbered in pattern order; a # wildcard yields the
joined remainder of the topic.
Sourcepub fn get_named_param(&self, name: &str) -> Option<Substr>
pub fn get_named_param(&self, name: &str) -> Option<Substr>
Returns the value of the named parameter name, if the pattern bound one.
Sourcepub fn topic_path(&self) -> ArcStr
pub fn topic_path(&self) -> ArcStr
Returns a cheap (refcounted) clone of the matched topic string.
Trait Implementations§
Source§impl Clone for TopicMatch
impl Clone for TopicMatch
Source§fn clone(&self) -> TopicMatch
fn clone(&self) -> TopicMatch
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 moreSource§impl Debug for TopicMatch
impl Debug for TopicMatch
Auto Trait Implementations§
impl Freeze for TopicMatch
impl RefUnwindSafe for TopicMatch
impl Send for TopicMatch
impl Sync for TopicMatch
impl Unpin for TopicMatch
impl UnsafeUnpin for TopicMatch
impl UnwindSafe for TopicMatch
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