-
Notifications
You must be signed in to change notification settings - Fork 3.5k
[Rust] Add ENUM_VALUES generation for bit_flags enums #8835
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?
[Rust] Add ENUM_VALUES generation for bit_flags enums #8835
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
@aardappel Hello, could you spare some time to review this PR? Thank you very much! |
|
what's a typical use case for this? |
|
would love to see a new test that showcases this feature <3 |
|
@jtdavis777 That's a great idea! I will add a test case to demonstrate this feature. |
|
hey @wentywenty just checking in on that test case :) |
|
@wentywenty Hello. do u need some help for this? |
This PR adds the generation of the ENUM_VALUES constant array for enums marked with the bit_flags attribute in Rust.
Motivation: Currently, standard enums generate an ENUM_VALUES array, but bit_flags enums do not. This makes it difficult to iterate over all defined base flag values (e.g., for UI lists, serialization helpers, or debugging).
Changes: Modified src/idl_gen_rust.cpp to generate an impl block containing ENUM_VALUES for bitflags, mirroring the behavior of standard enums.