re_cdr
CDR (Common Data Representation) codec for ROS 2 / DDS messages.
re_cdr decodes and encodes CDR.
It is aimed at ROS 2 reflection: decoding messages whose layout is only known at runtime, as when reading MCAP.
Inspired by cdr-encoding and hiroz-cdr.
API
CdrSerializer and CdrDeserializer integrate with serde for static Rust types.
CdrReader and CdrWriter read and write aligned primitives for runtime schemas. CdrReader::read_numeric_vec handles numeric arrays (float32[], uint32[], ...), using a byte-copy path when the message byte order matches the host and per-element reads otherwise.
Readers and writers are generic over byteorder::ByteOrder. Choose LittleEndian or BigEndian from the message encapsulation header.
Usage
Static types
use ;
use ;
let v = Vector3 ;
let bytes = .unwrap;
let = .unwrap;
assert_eq!;
assert_eq!;
License
Apache-2.0 or MIT