| Crates.io | omg-idl-gen |
| lib.rs | omg-idl-gen |
| version | 0.1.0 |
| created_at | 2025-12-29 23:10:52.445487+00 |
| updated_at | 2025-12-29 23:10:52.445487+00 |
| description | A command line tool reading OMG IDL and generating corresponding Rust data types. |
| homepage | https://github.com/gauntl3t12/omg-idl-gen |
| repository | https://github.com/gauntl3t12/omg-idl-gen |
| max_upload_size | |
| id | 2011662 |
| size | 29,604 |
A tool reading OMG IDLv4 and generating corresponding Rust data types and code.
Usage:
omg-idl-gen -I <include-dir> data.idl -o output.rs
1.84.1
The IDL types are mapped onto Rust as follows.
If a type-mapping has not been decided, it is marked with 'NA'.
As RTPS is a data-centric framework in contrast to
the the original OO background, the focus is put onto data structures, and ignoring interfaces and structures so far.
| IDL-Type | Rust-Type |
|---|---|
| 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, eg. 'T a[N]' | native array '[T;N]' |
| interface (non abstract) | NA |
| interface (abstract) | NA |
| constant (not within interface) | const |
| constant (within an interface) | NA |
| exception | std::result::Result |
| Any | NA |
| type declarations nested within interfaces | NA |
| typedef | type |
| pseudo objects | NA |
| readonly attribute | NA |
| readwrite attribute | NA |
| operation | NA |
| IDL | Rust |
|---|---|
sequence<octet> |
std::vec::Vec<u8> |
| IDL | Rust |
|---|---|
| typedef long Foo; | pub type Foo = i32; |
| typedef short Foo[2]; | pub type Foo = [i16;2] |
| typedef short Foo[2][3]; | pub type Foo = [[i16; 2]; 3] |
| typedef sequence |
pub type Foo = std::vec::Vec |
| IDL | Rust |
|---|---|
| struct Foo { long l; short s; }; |
pub struct Foo { pub l: i32, pub s: i16; } |
| IDL | Rust |
|---|---|
| enum Foo { VARIANT0, VARIANT1, VARIANT2 }; | pub enum Foo { VARIANT0, VARIANT1, VARIANT2, } |
Note: Only switch types "switch (long)" is supported yet.
| IDL | Rust |
|---|---|
| union Foo switch (long) { case LABEL0: long l; case LABEL1: case LABEL2: short s; default: octet o[8]; }; |
pub enum Foo { LABEL0{l: i32}, LABEL2{s: i16}, LABEL1{s: i16}, default{o: [u8; 8]}, } |
| /* not yet, to be developed */ union Result switch (long) { case None: void _dummy; case Some: T t }; |
/* not yet, to be developed */ pub enum Result<T> { None, Some(T), } |
**
The code underlying this repo was originally born in rtps-gen under the effort of Frank Rehberger. The original implementation has been updated to utilize Jinja templating, newer Rust standards, and reduced heap usage. The baselines will continue to diverage over time.