We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Given the Rust file foo.rs:
#[repr(u32)] pub enum A { Apple = 1, Pear = 2, Banana = 3, } #[repr(u32)] pub enum B { A = A::Apple as u32, B = A::Pear as u32, C = A::Banana as u32, }
and the cbindgen.toml config
language = "C" cpp_compat = false [export] include = ["A", "B"] item_types = ["enums"] [enum] rename_variants = "QualifiedScreamingSnakeCase"
The command cbindgen -c cbindgen.toml foo.rs generates:
cbindgen -c cbindgen.toml foo.rs
#include <stdarg.h> #include <stdbool.h> #include <stdint.h> #include <stdlib.h> enum A { A_APPLE = 1, A_PEAR = 2, A_BANANA = 3, }; typedef uint32_t A; enum B { B_A = (uint32_t)A_Apple, B_B = (uint32_t)A_Pear, B_C = (uint32_t)A_Banana, }; typedef uint32_t B;
Note that B_A is initialized from A_Apple rather than A_APPLE, ignoring the rename_variants = "QualifiedScreamingSnakeCase" config option.
B_A
A_Apple
A_APPLE
rename_variants = "QualifiedScreamingSnakeCase"
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Given the Rust file foo.rs:
and the cbindgen.toml config
The command
cbindgen -c cbindgen.toml foo.rs
generates:Note that
B_A
is initialized fromA_Apple
rather thanA_APPLE
, ignoring therename_variants = "QualifiedScreamingSnakeCase"
config option.The text was updated successfully, but these errors were encountered: