Module zenoh::key_expr

source ·
Expand description

Key expression are Zenoh’s address space.

In Zenoh, operations are performed on keys. To allow addressing multiple keys with a single operation, we use Key Expressions (KE). KEs are a small language that express sets of keys through a glob-like language.

These semantics can be a bit difficult to implement, so this module provides the following facilities:

§Storing Key Expressions

This module provides 3 flavours to store strings that have been validated to respect the KE syntax:

All of these types Deref to keyexpr, which notably has methods to check whether a given keyexpr::intersects with another, or even if a keyexpr::includes another.

§Tying values to Key Expressions

When storing values tied to Key Expressions, you might want something more specialized than a HashMap if you want to respect the Key Expression semantics with high performance.

Enter KeTrees. These are data-structures specially built to store KE-value pairs in a manner that supports the set-semantics of KEs.

§Building and parsing Key Expressions

A common issue in REST API is the association of meaning to sections of the URL, and respecting that API in a convenient manner. The same issue arises naturally when designing a KE space, and KeFormat was designed to help you with this, both in constructing and in parsing KEs that fit the formats you’ve defined.

kedefine also allows you to define formats at compile time, allowing a more performant, but more importantly safer and more convenient use of said formats, as the keformat and kewrite macros will be able to tell you if you’re attempting to set fields of the format that do not exist.

Modules§

  • This module implements the Key Expression Language, as explained in details in keyexpr’s documentation.
  • KeTrees are specialized data structures to work with sets of values addressed by key expressions.

Macros§

  • Create format modules from a format specification.
  • Write a set of values into a Formatter and then builds it into an OwnedKeyExpr, stopping as soon as a value doesn’t fit the specification for its field.
  • Write a set of values into a Formatter, stopping as soon as a value doesn’t fit the specification for its field. Contrary to keformat doesn’t build the Formatter into a Key Expression.

Structs§

Enums§