zerodds-cdr-derive 1.0.0-rc.5

#[derive(DdsType)] proc-macro for zerodds-xcdr2-rust-1.0 (TYPE_NAME + EXTENSIBILITY + IS_KEYED + encode/decode/key_hash).
Documentation

zerodds-cdr-derive

License

Proc-macro #[derive(DdsType)] for XCDR2 TypeSupport. Implements zerodds-xcdr2-rust-1.0 §11.1.

What this crate does

Annotates a plain Rust struct and emits at compile time an impl zerodds_dcps::DdsType implementation that encodes and decodes XCDR2 byte-exact against OMG XTypes 1.3 §7.4 — the same wire form as the idl-rust codegen.

Spec + layer

  • Spec: zerodds-xcdr2-rust-1.0 §11.1; XTypes 1.3 §7.4 + §7.6.8.4.
  • Layer: 1 Primitives (helper for zerodds-cdr and zerodds-dcps).

Quickstart

use zerodds_cdr_derive::DdsType;

#[derive(DdsType, Clone, PartialEq)]
pub struct Sensor {
    #[dds(key)]
    pub id: i32,
    pub value: f64,
}

// Auto-generates:
//   impl zerodds_dcps::DdsType for Sensor {
//       const TYPE_NAME: &'static str = "Sensor";
//       const HAS_KEY: bool = true;
//       fn encode(&self, out: &mut Vec<u8>) -> ... { ... }
//       fn decode(bytes: &[u8]) -> Result<Self, ...> { ... }
//       fn encode_key_holder_be(&self, holder: ...) { ... }
//   }

Feature flags

None.

Stability

All pub items are 1.0.0-rc.1-stable. The exact token layout of the macro output may change between minor versions; the emitted impl DdsType form stays spec-conformant.

Links