-
Notifications
You must be signed in to change notification settings - Fork 365
Support for Enums #1328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Support for Enums #1328
Conversation
@dorezyuk what's the status on this ? |
I think its in a zombie state - I've reached out when I was working on it to @dtolnay to check how to add this into the repo (its a massive PR after all) and David said he has capacity right now to review (and maintain) such large features. But it does not mean that the people interested in this (especially the cpp/Rust gurus here) should not review it. Maybe this will even help to ease the burden from David edit typo |
Well I'm not sure I qualify as a guru but I've read though the the diff and cross referenced the various docs (both official Rust/C++ and those you linked). To the best of my knowledge you've satisfied the invariants necessary and the static asserts seem to cover all the bases. There seems to be a few extraneous formatting changes mixed in but those might just be the un-resesolved conflicts. Very much hoping this gets picked up. I don't really want to have to maintain a fork for a project in the simi near future. |
@dorezyuk What are your thoughts on this being extracted into it's own macro and generator crate pair? What I'm thinking is that there is a proc macro like cxx-qt's that marks marks a module with a suitable enum and re-writes it to an processed enum and it's Then a paired generator crate that has a generator which is fed files with the macro like how the bridge builder is. The generator then emits a new rust file at the include point with the generated extern "C++" {
type #enum_ident = supper:: #enum_ident
} the generator also emits a class MyEnum: public ::rust::variant<Types> {
// ...
} and any headers needed the generator run in the |
PR adds
std::variant
like type with the same memory layout as Rust's enum and codegen code to generate binding to c++ from Rust.The PR is quite massive and I've know that there is currently little active development at this project. Nonetheless, if the development is ever picked up, it would be great to include the feature.
It should probably also go behind a feature flag..