Zero Network Overhead. No std. No alloc. Pure Rust.
bare-metal • no_std • zenoh
zenoh-nostd is a Rust-native, #![no_std], no_alloc library that provides a zero-overhead network abstraction layer for
ultra-constrained and bare-metal environments. In other terms you can run this bare metal on your favourite microcontroller.
⚡ Built on the Zenoh protocol, but stripped to the bone for minimalism and raw performance.
#![no_std]: No reliance on the Rust standard library.- No dynamic allocation: Fully
no_alloc, ideal for bare-metal targets. - Deterministic: No heap, no surprises.
- Safe Rust: Entirely memory-safe.
- Testable: Supports both embedded and native testing environments.
Soon.
Add this to your Cargo.toml:
[dependencies]
zenoh-nostd = { git = "https://github.com/ZettaScaleLabs/zenoh-nostd" }For embedded systems, ensure your crate uses
#![no_std]:
#![no_std]Here’s a simple example of sending a payload with zenoh-nostd:
#[embassy_executor::main]
async fn main(spawner: Spawner) {
let mut session = zenoh_nostd::open!(
zenoh_nostd::zconfig!(
PlatformStd: (spawner, PlatformStd {}),
TX: 512,
RX: 512,
SUBSCRIBERS: 2
),
EndPoint::try_from(CONNECT.unwrap_or("tcp/127.0.0.1:7447")).unwrap()
)
.unwrap();
let ke: &'static keyexpr = "demo/example".try_into().unwrap();
let payload = b"Hello, from std!";
session.put(ke, payload).await.unwrap();
}🛠️ Minimum Supported Rust Version: Currently
1.89.0
This project uses just for task management. Use just clippy to verify the crate and examples, just test to run the codec tests and just bench to run the codec benchmark.
🔍 Pull requests that slow down the codec should be rejected.
Use the following command structure:
just <platform> <example> [args]- Platforms:
std,esp32s3 - Examples:
z_put,z_sub
Set the CONNECT=<endpoint> environment variable to specify the endpoint (default is tcp/127.0.0.1:7447).
For esp32s3, you must also provide:
WIFI_SSIDWIFI_PASSWORD
See the ESP32 setup documentation for toolchain and target installation.
Run a Zenoh router with:
zenohd -l tcp/127.0.0.1:7447In two terminals:
# Terminal 1
just std z_put
# Terminal 2
just std z_subsrc/
├── keyexpr/ # Lightweight key expression parsing
├── protocol/ # Protocol definitions, encoding/decoding
├── platform/ # Platform abstraction (e.g., std support)
├── logging.rs # Logging facade
├── result.rs # Result and error types
├── zbuf.rs # Byte buffer extension traits
└── lib.rs # Library entry point
platforms/
└── zenoh-embassy # Integration with Embassy-based devices
The base project has been implemented in (#6)
📖 Note: Docs require
rustdocto be run with--no-default-features.
Build locally with:
cargo doc --no-deps --no-default-features --openLicensed under:
- ZettaScale Source-Available LICENSE
