pub struct TopicMatcher<T: Default> { /* private fields */ }
Expand description

A collection of topic filters to arbitrary objects.

This can be used to get an iterator to all items that have a filter that matches a topic. To test against a single filter, see TopicFilter. This collection is more commonly used when there are a nuber of filters and each needs to be associated with a particular action or piece of data. Note, though, that a single incoming topic could match against several items in the collection. For example, the topic: data/temperature/engine

Could match against the filters: data/temperature/# data/+/engine

Thus, the collection gives an iterator for the items matching a topic.

A common use for this would be to store callbacks to proces incoming messages based on topics.

This code was adapted from the Eclipse Python MQTTMatcher class: https://github.com/eclipse/paho.mqtt.python/blob/master/src/paho/mqtt/matcher.py

which use a prefix tree (trie) to store the values.

Implementations

Creates a new topic matcher collection.

Inserts a new topic filter into the collection.

Gets a value from the collection using an exact filter match.

Gets an iterator for all the matches to the specified

Determines if the topic matches any of the filters in the collection.

Trait Implementations

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.