Skip to content
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

Refactor enum generation #3112

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jschwe
Copy link
Contributor

@jschwe jschwe commented Feb 5, 2025

Gather all the enum variants and let the builder generate everything at once.
This allows us to simplify some logic and makes the code more readable, by putting the actual code generation close together in the build method.

For users, the main benefit is that Newtype enums now only have a single impl block, instead of one impl block per enum variant.

bindgen/codegen/mod.rs Outdated Show resolved Hide resolved
bindgen/codegen/mod.rs Outdated Show resolved Hide resolved
bindgen/codegen/mod.rs Show resolved Hide resolved
bindgen/codegen/mod.rs Outdated Show resolved Hide resolved
bindgen/codegen/mod.rs Outdated Show resolved Hide resolved
bindgen/codegen/mod.rs Show resolved Hide resolved
bindgen/codegen/mod.rs Outdated Show resolved Hide resolved
bindgen/codegen/mod.rs Outdated Show resolved Hide resolved
@emilio
Copy link
Contributor

emilio commented Feb 10, 2025

Could you squash the commits as well? Thanks.

Gather all the enum variants.
This allows us to simplify some logic, make the code more readable,
by putting the actual code generation close together in
the build method.

For users, the main benefit is that Newtype enums now only
have a single impl block, instead of one impl block per
enum variant.
@jschwe jschwe force-pushed the jschwender/enum_refactor branch from 0fc80e8 to e911598 Compare February 10, 2025 17:46
Copy link
Contributor

@emilio emilio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine to me, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants