pub struct TopicPatternPath { /* private fields */ }
Expand description
Parsed MQTT topic pattern with wildcard support
Implementations§
Source§impl TopicPatternPath
impl TopicPatternPath
Sourcepub fn new_from_string(
topic_pattern: impl Into<ArcStr>,
cache_strategy: CacheStrategy,
) -> Result<TopicPatternPath, TopicPatternError>
pub fn new_from_string( topic_pattern: impl Into<ArcStr>, cache_strategy: CacheStrategy, ) -> Result<TopicPatternPath, TopicPatternError>
Creates a topic pattern from string with optional caching.
Sourcepub fn cache_strategy(&self) -> CacheStrategy
pub fn cache_strategy(&self) -> CacheStrategy
Get the cache strategy of this topic pattern.
Sourcepub fn parameter_bindings(&self) -> Option<&SmallVec<[(ArcStr, ArcStr); 4]>>
pub fn parameter_bindings(&self) -> Option<&SmallVec<[(ArcStr, ArcStr); 4]>>
Returns the current parameter bindings, if any.
Sourcepub fn get_bound_value(&self, param_name: Option<&str>) -> Option<&ArcStr>
pub fn get_bound_value(&self, param_name: Option<&str>) -> Option<&ArcStr>
Returns the bound value for a named parameter, if it exists.
Sourcepub fn mqtt_pattern(&self) -> ArcStr
pub fn mqtt_pattern(&self) -> ArcStr
Returns MQTT pattern with wildcards for broker subscription with bound parameters applied.
Sourcepub fn resolve_bound_segments(&self) -> Vec<TopicPatternItem>
pub fn resolve_bound_segments(&self) -> Vec<TopicPatternItem>
Resolves bound parameters into concrete segments
Returns segments with bound parameters replaced by their values. Unbound wildcards remain as wildcards.
Sourcepub fn topic_pattern(&self) -> ArcStr
pub fn topic_pattern(&self) -> ArcStr
Returns original pattern with named parameters.
Sourcepub fn contains_hash(&self) -> bool
pub fn contains_hash(&self) -> bool
Returns true if pattern contains multi-level wildcard (#).
Sourcepub fn iter(&self) -> Iter<'_, TopicPatternItem>
pub fn iter(&self) -> Iter<'_, TopicPatternItem>
Returns iterator over pattern segments.
Sourcepub fn slice(&self) -> &[TopicPatternItem]
pub fn slice(&self) -> &[TopicPatternItem]
Returns pattern segments as slice.
Sourcepub fn format_topic(
&self,
params: &[&dyn Display],
) -> Result<String, TopicFormatError>
pub fn format_topic( &self, params: &[&dyn Display], ) -> Result<String, TopicFormatError>
Formats topic by substituting wildcards with provided parameters
Sourcepub fn check_pattern_compatibility(
&self,
custom_topic: impl TryInto>,
) -> Result<TopicPatternPath, TopicPatternError>where
<impl TryInto<TopicPatternPath> as TryInto<TopicPatternPath>>::Error: Into<TopicPatternError>,
pub fn check_pattern_compatibility(
&self,
custom_topic: impl TryInto>,
) -> Result<TopicPatternPath, TopicPatternError>where
<impl TryInto<TopicPatternPath> as TryInto<TopicPatternPath>>::Error: Into<TopicPatternError>,
Checks if the provided topic pattern is compatible with this one.
Static segments can differ, but wildcards must be identical in type, order, and names (if named).
Sourcepub fn with_cache_strategy(&self, new_cache: CacheStrategy) -> TopicPatternPath
pub fn with_cache_strategy(&self, new_cache: CacheStrategy) -> TopicPatternPath
Create new pattern with different cache strategy
Sourcepub fn bind_parameter(
self,
param_name: impl Into<ArcStr>,
value: impl Into<ArcStr>,
) -> Result<TopicPatternPath, TopicPatternError>
pub fn bind_parameter( self, param_name: impl Into<ArcStr>, value: impl Into<ArcStr>, ) -> Result<TopicPatternPath, TopicPatternError>
Add value for topic wildcard parameter
Sourcepub fn try_match(
&self,
topic: Arc<TopicPath>,
) -> Result<Arc<TopicMatch>, TopicMatchError>
pub fn try_match( &self, topic: Arc<TopicPath>, ) -> Result<Arc<TopicMatch>, TopicMatchError>
Matches topic path against this pattern, extracting parameters.
Trait Implementations§
Source§impl Clone for TopicPatternPath
impl Clone for TopicPatternPath
Source§fn clone(&self) -> TopicPatternPath
fn clone(&self) -> TopicPatternPath
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more