summaryrefslogtreecommitdiff
path: root/tests/headers/convert-cpp-comment-to-rust.hpp
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-06-21 05:03:08 -0700
committerGitHub <noreply@github.com>2017-06-21 05:03:08 -0700
commit480c2d197199e7b1f824a01cc63acd33d81f6622 (patch)
treea244ca35506dc52f8a965a797dedeaa5715a5e82 /tests/headers/convert-cpp-comment-to-rust.hpp
parent232a21ebc4a4ddc2468aed8e54d165c613037038 (diff)
parent814d28e0f256a24865f633b5992ced6f035d6f4c (diff)
Auto merge of #741 - tmfink:feature-699-constified-enum-module, r=emilio
Feature 699 constified enum module This is a work in progress for issue #699 that adds the `--constified-enum-module` option to bindgen. @emilio, could you give me some guidance on fixing the uses of the enum variant types? In the example below, `foo` should be replaced with `foo::Type`. I'm not sure of the proper way to rename `Item`s after the structures have been defined. My initial thought was to redefine the `CodeGenerator` trait to take a mutable reference to `item`, but that will not work because of the borrow checker. Thoughts? Todo: - [x] put constified enum variants in a `mod` - [x] ensure references to constified enum `foo` are changed to `foo::Type` - [x] handle `typedef` enums ----- Given the input header `tests/headers/constify-module-enums.h`: ~~~c // bindgen-flags: --constified-enum-module foo enum foo { THIS, SHOULD_BE, A_CONSTANT, }; struct bar { enum foo this_should_work; }; ~~~ `$ cargo run -- tests/headers/constify-module-enums.h --constified-enum-module foo --no-layout-tests` will output: ~~~rust /* automatically generated by rust-bindgen */ pub mod foo { pub type Type = ::std::os::raw::c_uint; pub const THIS: Type = 0; pub const SHOULD_BE: Type = 1; pub const A_CONSTANT: Type = 2; } #[repr(C)] #[derive(Debug, Copy)] pub struct bar { pub this_should_work: foo, } impl Clone for bar { fn clone(&self) -> Self { *self } } ~~~
Diffstat (limited to 'tests/headers/convert-cpp-comment-to-rust.hpp')
0 files changed, 0 insertions, 0 deletions