| Crates.io | zenoh |
| lib.rs | zenoh |
| version | 1.7.2 |
| created_at | 2020-09-10 13:26:06.111239+00 |
| updated_at | 2026-01-08 16:07:23.442913+00 |
| description | Zenoh: The Zero Overhead Pub/Sub/Query Protocol. |
| homepage | http://zenoh.io |
| repository | https://github.com/eclipse-zenoh/zenoh |
| max_upload_size | |
| id | 287031 |
| size | 2,369,523 |
Eclipse Zenoh: Zero Overhead Pub/Sub, Store/Query and Compute.
Zenoh (pronounce /zeno/) unifies data in motion, data at rest and computations. It carefully blends traditional pub/sub with geo-distributed storages, queries and computations, while retaining a level of time and space efficiency that is well beyond any of the mainstream stacks.
Check the website zenoh.io for more information and installation instructions
See also the roadmap for more detailed technical information.
The crate zenoh provides the main implementation of the Zenoh network protocol in Rust and the API to use it.
The primary features of Zenoh are
Publishing data:
#[tokio::main]
async fn main() {
let session = zenoh::open(zenoh::Config::default()).await.unwrap();
session.put("key/expression", "value").await.unwrap();
session.close().await.unwrap();
}
Subscribing to data:
use futures::prelude::*;
#[tokio::main]
async fn main() {
let session = zenoh::open(zenoh::Config::default()).await.unwrap();
let subscriber = session.declare_subscriber("key/expression").await.unwrap();
while let Ok(sample) = subscriber.recv_async().await {
println!("Received: {:?}", sample);
};
}
Declare a queryable:
#[tokio::main]
async fn main() {
let session = zenoh::open(zenoh::Config::default()).await.unwrap();
let queryable = session.declare_queryable("key/expression").await.unwrap();
while let Ok(query) = queryable.recv_async().await {
query.reply("key/expression", "value").await.unwrap();
}
}
Request data:
use futures::prelude::*;
#[tokio::main]
async fn main() {
let session = zenoh::open(zenoh::Config::default()).await.unwrap();
let replies = session.get("key/expression").await.unwrap();
while let Ok(reply) = replies.recv_async().await {
println!(">> Received {:?}", reply.result());
}
}
The crate zenoh can be compiled with Rust 1.75.0, but some of its dependencies may require higher Rust versions.
To compile zenoh with Rust 1.75, add a dependency on the crate zenoh-pinned-deps-1-75 to your Cargo.toml:
zenoh = "1.5.1"
zenoh-pinned-deps-1-75 = "1.5.1"
For more information, see its documentation: https://docs.rs/zenoh and some examples of usage in https://github.com/eclipse-zenoh/zenoh/tree/main/examples