matches

Function matches 

Source
pub fn matches(topic: &str, filter: &str) -> bool
Expand description

Matches a topic name against a topic filter with wildcard support

§Arguments

  • topic - The topic name to match (no wildcards allowed)
  • filter - The topic filter which may contain wildcards

§Returns

  • true if the topic matches the filter
  • false otherwise

§Examples

assert!(matches("sport/tennis", "sport/tennis"));
assert!(matches("sport/tennis", "sport/+"));
assert!(matches("sport/tennis/player1", "sport/#"));
assert!(!matches("sport/tennis", "sport/+/player1"));