6 releases

new 0.11.0-rc.3 May 14, 2024
0.11.0-rc.2 Apr 30, 2024
0.10.1-rc Dec 20, 2023
0.10.0-rc Sep 26, 2023
0.0.0 Apr 18, 2023

#31 in #zenoh

Download history 640/week @ 2024-01-22 730/week @ 2024-01-29 774/week @ 2024-02-05 728/week @ 2024-02-12 776/week @ 2024-02-19 721/week @ 2024-02-26 934/week @ 2024-03-04 912/week @ 2024-03-11 1390/week @ 2024-03-18 986/week @ 2024-03-25 1178/week @ 2024-04-01 1259/week @ 2024-04-08 1370/week @ 2024-04-15 1499/week @ 2024-04-22 1625/week @ 2024-04-29 1110/week @ 2024-05-06

5,648 downloads per month
Used in 58 crates (10 directly)

EPL-2.0 OR Apache-2.0

330KB
7K SLoC

⚠️ WARNING ⚠️

This crate is intended for Zenoh's internal use.


lib.rs:

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 2 flavours to store strings that have been validated to respect the KE syntax, and a third is provided by zenoh:

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.

Dependencies

~2–3.5MB
~56K SLoC