Skip to main content

intersects

Function intersects 

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

Returns whether two key expressions share at least one key.

This is the relation Zenoh routes by: a publication on one expression reaches a subscriber on another exactly when the two intersect. It is symmetric.

§Arguments

  • a - one key expression; it may contain wildcards.
  • b - the other key expression; it may contain wildcards.

§Returns

true if some concrete key is selected by both; false if none is, or if either expression is not valid.

§Examples

use pamoja_zenoh::keyexpr::intersects;

assert!(intersects("fleet/*/battery", "fleet/n7/**")); // both select fleet/n7/battery
assert!(!intersects("fleet/*/battery", "fleet/*/rack/**"));
assert!(!intersects("fleet/@v1/**", "fleet/*/**")); // a verbatim chunk is sealed off