-
Notifications
You must be signed in to change notification settings - Fork 106
Closed
Description
Summary
TopicMatcher behaviour is nowhere near the advertised behaviour, and it differs from the Python implementation
Example
from paho.mqtt.matcher import MQTTMatcher
matcher = MQTTMatcher()
matcher["$MAC/+/+/rpc"] = "_/device_type/systemid/_"
matcher["$MAC/+/+/+/rpc"] = "_/device_type/systemid/zoneid/_"
matcher["$MAC/+/rpc"] = "_/device_type/_"
matcher["$MAC/rpc"] = ""
print(list(matcher.iter_match("$MAC/humidifier/1/rpc")))
# ['_/device_type/systemid/_']use paho_mqtt::topic_matcher::TopicMatcher;
fn main() {
let mut topic_matcher = TopicMatcher::new();
topic_matcher.insert("$MAC/+/+/rpc", "_/device_type/systemid/_");
// Comment all inserts below to see the difference
topic_matcher.insert("$MAC/+/+/+/rpc", "_/device_type/systemid/zoneid/_");
topic_matcher.insert("$MAC/+/rpc", "_/device_type/_");
topic_matcher.insert("$MAC/rpc", "");
let matches: Vec<_> = topic_matcher.matches("$MAC/humidifier/1/rpc").collect();
println!("{:?}", matches);
// Prints []
// Only works if it is the only insertion
}MRE
Metadata
Metadata
Assignees
Labels
No labels