eclipse / paho.mqtt.rust

paho.mqtt.rust
Other
516 stars 102 forks source link

Initial TopicMatcher class kinda useless. #156

Closed fpagliughi closed 1 year ago

fpagliughi commented 2 years ago

The initial implementation of the TopicMatcher class which was introduced in v0.10.0 does a pretty poor job for it's primary purpose: to help match incoming messages to callbacks based on the topic of each message.

In particular:

gaoqiangz commented 2 years ago

Missing methods: remove/get_mut/matches_mut.

fpagliughi commented 2 years ago

@gaoqiangz , yes! The initial version was definitely a hack. I'm not a CS, so I'm trying to figure out a better way to implement this in Rust. I should have something better with a mutable iterator, and all that, by the next release.

fpagliughi commented 2 years ago

OK. I refactored the implementation, particularly that of the Node and iterator, which allowed me to implement a matching mutable iterator. So the requested functions are in place, but note that remove() currently only removes the value at the requested node; it doesn't remove any nodes from the branch that may no longer be needed.

I'm happy to take a PR if anyone wants to give that a try.

It's currently in the develop branch.