Skip to main content

is_canon

Function is_canon 

Source
pub fn is_canon(ke: &str) -> bool
Expand description

Returns whether a key expression is valid and in canonical form.

The canonical form is the only one a Zenoh session accepts: the Zenoh API refuses any other spelling, and a router that receives one drops the message and closes the connection.

§Arguments

  • ke - the candidate key expression.

§Returns

true if ke equals its own canonize output, so two expressions selecting the same keys compare equal as strings.

§Examples

use pamoja_zenoh::keyexpr::is_canon;

assert!(is_canon("fleet/*/**"));
assert!(!is_canon("fleet/**/*")); // the same keys, spelled the other way round