capnproto / capnpc-rust

Cap'n Proto code generation for Rust
76 stars 26 forks source link

Making type IDs accessible from Rust code #1

Closed ghost closed 9 years ago

ghost commented 9 years ago

The current generated code doesn't seem to include the "Unique IDs" of the struct / enum / interface / annotation. Could we add something like a const TYPE_ID: u64 = id in every relevant mod ?

Also, it would probably be difficult to keep an interface similar to the C++ one capnp::typeId<CapnprotoType>();: as a capnproto type is defined as a module, I don't think it is possible to take it as a parameter in a function or make it implement a HasTypeId trait (although it should be possible for a Reader or Builder)

dwrensha commented 9 years ago

Yes, this would be good to have. It should be straightforward to add, but I don't when I'll get around to it.

I would accept a pull request that added it.

dwrensha commented 9 years ago

closed via #2