Skip to main content

includes

Function includes 

Source
pub fn includes(a: &str, b: &str) -> bool
Expand description

Returns whether one key expression selects every key another one selects.

§Arguments

  • a - the key expression that may be the wider one.
  • b - the key expression tested for being covered by a.

§Returns

true if every concrete key b selects is also selected by a, so a subscription on a already receives everything one on b would; false otherwise, or if either expression is not valid. An expression includes itself, and inclusion implies intersects.

§Examples

use pamoja_zenoh::keyexpr::includes;

assert!(includes("fleet/**", "fleet/*/battery"));
assert!(!includes("fleet/*/battery", "fleet/**"));
assert!(includes("fleet/n$*", "fleet/n7")); // the sub-chunk wildcard selects within a chunk