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

Add --derives option to bindgen to allow emitting custom #[derive] attributes #2895

Closed
wants to merge 1 commit into from

Conversation

dpaoliello
Copy link
Collaborator

Issue Details:
While Rust allows trait impl blocks in either the crate that defines the struct or the trait, #[derive] attributes must be applied directly to the struct definition. This makes deriving implementations of common traits (like Default or Copy) for generated structs impossible without modifying the generated rs file.

Fix Details:
Add a new option, --derive <ty=traits> that allows a list of traits to derive for a given type.

# Conflicts:
#	crates/libs/bindgen/src/rust/mod.rs
#	crates/libs/bindgen/src/rust/standalone.rs
#	crates/libs/bindgen/src/rust/structs.rs
#	crates/tests/standalone/build.rs
@kennykerr
Copy link
Collaborator

Closing in favor of #2907

@kennykerr kennykerr closed this Mar 1, 2024
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