Skip to main content

Module keyexpr

Module keyexpr 

Source
Expand description

The Zenoh key-expression language: validity, canonical form, and matching.

A key expression is a /-joined list of non-empty chunks. A chunk is either a literal, the single-chunk wildcard * (one non-empty chunk), the multi-chunk wildcard ** (zero or more chunks), or a literal carrying the sub-chunk wildcard $* (any run of characters, including none, within one chunk). A concrete key carries no wildcards. Leading, trailing, and doubled / are forbidden, as are the bare characters *, $, ?, and # outside the wildcard forms.

The rules follow the Zenoh key-expression specification, including its canonical-form rules: **/** collapses to **, **/* reorders to */**, $*$* collapses to $*, and a chunk that is exactly $* becomes *.

Functionsยง

canonize
Returns the canonical form of a key expression, or None if it is invalid.
is_canon
Returns whether a key expression is valid and in canonical form.
is_valid
Returns whether a string is a well-formed key expression.
matches
Returns whether a concrete key is selected by a pattern key expression.