Rust Bindings Overview
AstuteDDS ships safe Rust bindings as a pair of crates that live in
bindings/rust/ of the source tree:
| Crate | Role |
|---|---|
astutedds-sys |
Raw FFI bindings to the AstuteDDS C API (include/astutedds/c/astutedds.h). |
astutedds |
Safe, idiomatic RAII wrappers over astutedds-sys — what application code uses. |
Both crates target Rust edition 2021 and are linked against the in-tree
libastutedds.a static library via the links = "astutedds" key in
astutedds-sys.
What you get
DomainParticipant— RAII handle to a DDS domain participant, dropped on scope exit.Topic,Publisher,Subscriber— entity factories with lifetimes bound to the owning participant.DataWriter::write(&[u8])— publish a CDR-encoded payload.DataReader::take_next()— take the next sample from the reader cache (returnsErr(Error::NoData)when empty).DataReader::unread_count()— number of unread samples currently cached.DataWriterQos/DataReaderQos— small,CopyQoS structs covering reliability, history, and durability.Reliability,HistoryKind,Durability— enum re-exports from the C API.Error— a single error enum covering DDS return codes, null-pointer returns, interior nul bytes in strings,NoData, andTimeout.
RAII and thread safety
Every wrapper implements Drop to invoke the matching
astutedds_delete_* function. Lifetimes statically enforce that a
DataWriter/DataReader cannot outlive its Topic, and a Topic,
Publisher, or Subscriber cannot outlive its DomainParticipant.
All handles are marked Send + Sync so they can be shared across threads
in Arc<…>.
Wire format
DataWriter::write and DataReader::take_next exchange raw byte buffers.
Encode/decode the CDR payload yourself (or with a helper crate) — see the
Sensor example for a hand-rolled XCDR1
layout.
Supported platforms
| OS | Architectures | Toolchain |
|---|---|---|
| Linux (glibc ≥ 2.28 — RHEL/Alma 9+, Ubuntu 22.04+) | x86_64, aarch64 |
stable Rust (1.75+) |
| macOS 11+ | Intel (x86_64), Apple Silicon (arm64) |
stable Rust (1.75+) |
| Windows 10/11 | x86_64-pc-windows-msvc |
stable Rust (1.75+) + MSVC |
Next steps
- Installation — add the crates to your
Cargo.tomlor build them via CMake. - Quick Start — first publisher and subscriber.
- Examples — Hello World and a multi-channel Sensor demo.
- API Surface — what's exported from the
astuteddscrate.