Klapeyron/rtps-rs

IDL to Rust type mapping/generator

Closed this issue · 1 comments

Hi everybody,

Many DDS/RTPS systems are using IDL files, declaring the interchange message formats. These IDL files can be transformed into the corresponding syntax of the target-application-language such as Java, C++, Python.

The following implementation is a starting point to define such IDL-Language mapping for Rust, it shall cover also the Rust-Serde Serializer-Deserializer functionality.
https://github.com/frehberg/rtps-gen

The final version of the code-generator shall

  • read the IDL type-declarations and constants (no interfaces), and generating corresponding Rust-types/values
  • generating corresponding functionality for the Serde Serialization/Deserialzation framework of Rust
  • generating corresponding DCPS_DATA_KEY hash-functionality

Please could you comment the Rust-Language-Mapping, if it fits to your ideas?
https://github.com/frehberg/rtps-gen/blob/master/README.md

Hello,
sounds good 👍 . From my perspective, I have for now assumed, that data structures will be represented just as vectors of bytes. In case of that, they should not depend on the form of the data and allow user to decide which serialization/de-serialization to use. Of course it breaks possibility to apply content based filtering, but it can be added in further versions. I thought also about application of serde, mostly following cdr support: https://github.com/hrektts/cdr-rs. In case of that, maybe it is good idea to expose data as something that implements Serialize/Deserialize traits, so it should also fit in your implementation when you will generate from idl structures that implement it.

In case of DCPS_DATA_KEY, it is mostly md5 calculation, am I right?