cyclonedds-rust
Safe, idiomatic Rust bindings for Eclipse CycloneDDS — a high-performance implementation of the OMG Data Distribution Service (DDS) specification.
Highlights
- Complete DDS entity model — DomainParticipant, Publisher, Subscriber, Topic, DataWriter, DataReader
- 26+ QoS policies via a type-safe
QosBuilderpattern - 13 listener callbacks via
ListenerBuilder(data available, matched, liveliness, deadline, etc.) - WaitSet / ReadCondition / QueryCondition / GuardCondition for event-driven architectures
- Derive macros for topic types:
DdsType,DdsEnum,DdsUnion,DdsBitmask - CDR serialization (XCDR1/XCDR2), dynamic types, type discovery (XTypes)
- Async Streams (
read_aiter,take_aiter) with tokio integration
Quick Start
Add to your Cargo.toml:
[]
= "1.0"
Define a Topic Type
use *;
Publisher
Subscriber
Async Streams
When the async feature is enabled (default), DataReader provides async iterators over incoming samples:
use DataReader;
use StreamExt;
async
Feature Matrix
| Feature | Python (CycloneDDS) | .NET | Rust (this crate) |
|---|---|---|---|
| Core Entities | Yes | Partial | Yes |
| QoS (26+) | Yes | Partial | Yes |
| Listeners (13) | Yes | Partial | Yes |
| WaitSet / Conditions | Yes | No | Yes |
| CDR Serialization (XCDR1/2) | Yes | Yes | Yes |
| Dynamic Types & Data | Yes | No | Yes |
| Type Discovery (XTypes) | Yes | No | Yes |
| Content-Filtered Topics | Yes | Partial | Yes (closure-based) |
| Union / Bitmask / Enum | Yes | Partial | Yes |
| IDL Compilation | Yes | Yes | Yes |
| CLI Tools | Yes | No | Yes (ls, ps, subscribe, typeof, publish) |
Async Streams (read_aiter, take_aiter) |
No | No | Yes |
| Matched Endpoint Data | Yes | No | Yes |
| Zero-copy Write Loan | No | Yes | Yes |
| DDS Security | Yes | No | Planned post-v1.0 |
Workspace Crates
| Crate | Description |
|---|---|
cyclonedds-sys |
Low-level FFI bindings (generated via bindgen) |
cyclonedds |
High-level safe Rust API |
cyclonedds-derive |
Procedural derive macros (DdsType, DdsEnum, DdsUnion, DdsBitmask) |
cyclonedds-build |
Build-time helpers for generating types from IDL |
cyclonedds-idlc |
IDL compiler backend producing Rust source from IDL files |
cyclonedds-cli |
Command-line tools (ls, ps, subscribe, typeof, publish, perf) |
cyclonedds-test-suite |
Integration tests |
Build
Requirements
- Rust 1.85+ (MSRV)
- CMake 3.10+
- C/C++ compiler
Note: Clang is no longer required for end users. Prebuilt FFI bindings are shipped with the crate. Clang is only needed if you are a maintainer regenerating bindings (see
scripts/regenerate-bindings.sh).
The bundled CycloneDDS source in cyclonedds-src is built automatically by cyclonedds-rust-sys when CMake is available.
WSL Notes
If building in WSL, ensure libddsc.so is discoverable after the first build:
CLI Examples
# List all topics in a domain
# Show participant status
# Subscribe to a topic
# Show type info
Examples
# Terminal 1 - subscriber
# Terminal 2 - publisher
Documentation
- Getting Started — installation, first steps, WSL notes
- API Guide — tour of all major API features
- Type System —
DdsTypederive, supported types, CDR encoding - QoS Reference — all QoS policies and builder patterns
- Migration from Python — guide for
cyclonedds-pythonusers
Known Limitations
- DDS Security: Not supported in v1.0. Planned for a future release.
- CLI
publish: Currently supports simple string messages and dynamic types discovered at runtime. Complex structs require using the Rust API directly. - PSMX / Iceoryx: Shared memory transport is not yet configurable via the Rust API.
Benchmarks
License
Licensed under the MIT License.
Acknowledgments
Built on Eclipse CycloneDDS — a high-performance DDS implementation.