-
Notifications
You must be signed in to change notification settings - Fork 6
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
codegen: enum #16
Comments
Related: OpenCyphal/specification#52 |
I made some changes a while ago, but now I've released the new version. It uses a special Documentation: https://github.com/samcrow/canadensis/blob/85cb16bc7c06f5d42438d4e34afd42d002e6ca14/canadensis_codegen_rust/src/struct_as_enum.rs |
amazing! |
I don't know the best way to do this, but it'd be really great if the dsdl definitions could compile into rust enums, for instance if you have
it would be compiled into
Of course this would be kinda hard to do automatically as well as this with regards to naming in a predictable way, but anything like this would be really great. Could do it automatically if the file just contains a bunch of defines like this, maybe look for a specific comment, or take a config file / cli args.
Ways I can think of
Note: we can use rust-like #[] because # declares a comment in dsdl
Start & end
Explicit member
Here we can specify the name of the enum, and it would remove this prefix from the enum members, like in the rust example above.
Smart compiler
If the "block" consists of constants of the same type, just turn them into an enum
The text was updated successfully, but these errors were encountered: