File tree 4 files changed +31
-4
lines changed 4 files changed +31
-4
lines changed Original file line number Diff line number Diff line change 1
1
extern crate bindgen;
2
2
extern crate cc;
3
3
4
- use bindgen:: callbacks:: { MacroParsingBehavior , ParseCallbacks , IntKind } ;
5
- use bindgen:: Builder ;
4
+ use bindgen:: callbacks:: { IntKind , MacroParsingBehavior , ParseCallbacks } ;
5
+ use bindgen:: { Builder , EnumVariation } ;
6
6
use std:: collections:: HashSet ;
7
7
use std:: env;
8
8
use std:: path:: PathBuf ;
@@ -147,7 +147,9 @@ fn main() {
147
147
let bindings = Builder :: default ( )
148
148
. rustfmt_bindings ( false )
149
149
. enable_cxx_namespaces ( )
150
- . rustified_enum ( ".*" )
150
+ . default_enum_style ( EnumVariation :: Rust {
151
+ non_exhaustive : false ,
152
+ } )
151
153
. raw_line ( "pub use self::root::*;" )
152
154
. raw_line ( "extern { fn my_prefixed_function_to_remove(i: i32); }" )
153
155
. module_raw_line ( "root::testing" , "pub type Bar = i32;" )
@@ -159,6 +161,8 @@ fn main() {
159
161
seen_funcs : Mutex :: new ( 0 ) ,
160
162
} ) )
161
163
. blacklist_function ( "my_prefixed_function_to_remove" )
164
+ . constified_enum ( "my_prefixed_enum_to_be_constified" )
165
+ . opaque_type ( "my_prefixed_templated_foo<my_prefixed_baz>" )
162
166
. generate ( )
163
167
. expect ( "Unable to generate bindings" ) ;
164
168
Original file line number Diff line number Diff line change @@ -134,4 +134,4 @@ Seventh::assert(bool first,
134
134
135
135
int my_prefixed_function_name () {
136
136
return 4 ;
137
- }
137
+ }
Original file line number Diff line number Diff line change @@ -210,4 +210,21 @@ struct my_prefixed_foo {
210
210
my_prefixed_bar member;
211
211
};
212
212
213
+ enum my_prefixed_enum_to_be_constified {
214
+ ONE = 1 ,
215
+ TWO,
216
+ THREE,
217
+ };
218
+
219
+ struct my_prefixed_baz {
220
+ char foo[30 ];
221
+ };
222
+
223
+ template <typename T>
224
+ struct my_prefixed_templated_foo {
225
+ T member;
226
+ };
227
+
228
+ my_prefixed_templated_foo<my_prefixed_baz> TEMPLATED_CONST_VALUE;
229
+
213
230
void my_prefixed_function_to_remove ();
Original file line number Diff line number Diff line change @@ -245,6 +245,12 @@ fn test_item_rename() {
245
245
} ;
246
246
}
247
247
248
+ #[ test]
249
+ fn test_matching_with_rename ( ) {
250
+ assert_eq ! ( bindings:: enum_to_be_constified_THREE, 3 ) ;
251
+ assert_eq ! ( unsafe { bindings:: TEMPLATED_CONST_VALUE . len( ) } , 30 ) ;
252
+ }
253
+
248
254
#[ test]
249
255
fn test_macro_customintkind_path ( ) {
250
256
let v: & std:: any:: Any = & bindings:: TESTMACRO_CUSTOMINTKIND_PATH ;
You can’t perform that action at this time.
0 commit comments