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.5"
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, discover, echo, record, replay, monitor, health, topology) |
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 | Yes (SecurityConfig + --features security) |
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, discover, echo, record, replay, monitor, health, topology) |
cargo-cyclonedds |
Cargo plugin (cargo cyclonedds generate <idl>) |
cyclonedds-bench |
Criterion benchmarks (latency, throughput, CDR) |
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
# Subscribe with JSON output and filter
# Show type info
# Publish at 10 Hz
# Monitor throughput
# Health check
# Generate topology graph
# Subscribe to multiple topics simultaneously
# Bridge samples from one topic to another (optionally across domains)
Examples
# Terminal 1 - subscriber
# Terminal 2 - publisher
Documentation
- Getting Started — installation, first steps, WSL notes
- Tutorial — step-by-step first DDS application
- API Guide — tour of all major API features
- Type System —
DdsTypederive, supported types, CDR encoding - QoS Reference — all QoS policies and builder patterns
- ROS2 Integration — communicating with ROS2 nodes
- Security Guide — DDS Security setup and certificates
- Observability —
tracingintegration for structured logs and spans - Benchmarks — running performance benchmarks and comparisons
- Fuzzing — automated fuzz testing with
cargo-fuzz - FAQ — frequently asked questions and troubleshooting
- Migration from Python — guide for
cyclonedds-pythonusers
Known Limitations
- CLI
publish: Supports string messages, JSON payloads, and dynamic types discovered at runtime. Complex nested structs may require using the Rust API directly for full control. - DDS Security on Windows: Requires OpenSSL to be installed and
OPENSSL_ROOT_DIRconfigured. Thesecurityfeature is disabled by default on Windows CI to avoid build issues.
Benchmarks
License
Licensed under the MIT License.
Acknowledgments
Built on Eclipse CycloneDDS — a high-performance DDS implementation.