2个不稳定版本
| 0.2.0 | 2019年1月12日 |
|---|---|
| 0.1.0 | 2019年1月11日 |
#6 在 #rtps
74KB
1.5K SLoC
RTPS IDL到Rust代码生成器
一个读取IDL并生成相应Rust代码的工具。
用法
rtps-gen -I <include-dir> data.idl -o output.rs
RTPS-IDL到Rust映射
IDL类型映射到Rust如下。如果尚未确定类型映射,则用'NA'标记。
由于RTPS是一个以数据为中心的框架,与原始OO背景相比,重点关注数据结构,至今尚未关注接口和结构。
| IDL类型 | Rust类型 |
|---|---|
| module | module |
| boolean | bool |
| char/wchar | char |
| octet | u8 |
| string/wstring | std::string::String |
| short | i16 |
| long | i32 |
| long long | i64 |
| unsigned short | u16 |
| unsigned long | u32 |
| unsigned long long | u64 |
| float | f32 |
| double | f64 |
| fixed | NA |
| enum | enum |
| union | enum |
| struct | struct |
| sequence | std::vec::Vec |
| array, 例如 'T a[N]' | native array '[T;N]' |
| interface (非抽象) | NA |
| interface (抽象) | NA |
| constant (不在接口内) | const |
| constant (在接口内) | NA |
| exception | std::result::Result |
| Any | NA |
| 接口内嵌的类型声明 | NA |
| typedef | type |
| pseudo objects | NA |
| readonly attribute | NA |
| readwrite attribute | NA |
| operation | NA |
依赖
~3.5MB
~73K SLoC