KeyExpr constructor
- String expr
Creates a KeyExpr from the given key expression string.
The expression crosses to native as a pointer and a byte length, so the full key expression domain survives construction byte-exact -- including an interior NUL, which the grammar permits and canon accepts.
This door is strict. It rejects an expression that is merely not in
canon form (a/**/**/c) just as firmly as one that is invalid (a//b),
rather than rewriting it — so what you passed is what you get. For the
door that constructs through the rewrite, see KeyExpr.autocanonize;
to ask the question without constructing anything, see isCanon.
⚠️ expr is judged as bytes. A lone surrogate in the Dart string is
replaced with U+FFFD by utf8.encode before zenoh sees anything, so
value reads back the substituted form rather than the input string.
Throws ZenohException if expr is not a valid key expression
(e.g., empty string).
Implementation
KeyExpr(String expr) : this._encoded(expr, utf8.encode(expr));