IDL from build.rs, without the CLI
The companion for
zerodds-build: aprost-build-style build-script helper that compiles.idlto Rust through the shared composition pipeline — no external binary, noPATHrequirement.
- Example:
zerodds-build-sample - Repository: zero-dds-snippets
What it shows
- The pipeline it runs is the one the CLI runs:
#includetracking, vendor key-pragmas, default extensibility and TypeObject lowering. idl/Pose.idlholds a plain@appendable struct Pose;idl/Robot.idladds#include "Pose.idl", astruct Unitwith a nestedPose, and#pragma keylist Unit id— the Cyclone/OpenSplice/RTI pragma spelling of@key, not the OMG IDL 4.2 annotation.- The roundtrip test asserts both that
Unit's wire form carries the CDR key encoding the pragma should have produced and that the TypeObject block is non-empty — proof the full pipeline ran. - Contrast with idlc-buildrs: that one shells out to the compiled CLI and needs it on
PATH.
Build and run
cargo test # roundtrip + TypeObject unit test on the lib target
cargo run --bin zerodds-build-sample-demo
Output
zerodds-build-sample-demo: 36 bytes on the wire, roundtripped Unit { id: 7, pose: Pose { x: 1.0, y: 2.0, theta: 0.5 } }
Taken verbatim from the example's own README.
See also
IDL aus build.rs, ohne die CLI
Der Begleiter für
zerodds-build: ein Build-Script-Helfer im Stil vonprost-build, der.idlüber die geteilte Kompositions-Pipeline nach Rust übersetzt — kein externes Binary, keinePATH-Anforderung.
- Beispiel:
zerodds-build-sample - Repository: zero-dds-snippets
Was es zeigt
- Die Pipeline, die es fährt, ist die der CLI:
#include-Verfolgung, Vendor-Key-Pragmas, Default-Extensibility und TypeObject-Lowering. idl/Pose.idlenthält ein einfaches@appendable struct Pose;idl/Robot.idlergänzt#include "Pose.idl", einstruct Unitmit verschachteltemPoseund#pragma keylist Unit id— die Pragma-Schreibweise von Cyclone/OpenSplice/RTI für@key, nicht die OMG-IDL-4.2-Annotation.- Der Roundtrip-Test sichert zu, dass die Wire-Form von
Unitdie CDR-Key-Kodierung trägt, die das Pragma erzeugen sollte, und dass der TypeObject-Block nicht leer ist — Beleg, dass die vollständige Pipeline lief. - Im Gegensatz zu idlc-buildrs: Das ruft die kompilierte CLI auf und braucht sie auf dem
PATH.
Bauen und ausführen
cargo test # Roundtrip- und TypeObject-Unit-Test auf dem Lib-Target
cargo run --bin zerodds-build-sample-demo
Ausgabe
zerodds-build-sample-demo: 36 bytes on the wire, roundtripped Unit { id: 7, pose: Pose { x: 1.0, y: 2.0, theta: 0.5 } }
Wörtlich aus dem README des Beispiels übernommen.