File tree 2 files changed +22
-0
lines changed
2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -253,6 +253,10 @@ impl Builder {
253
253
output_vector. push ( "--no-layout-tests" . into ( ) ) ;
254
254
}
255
255
256
+ if !self . options . derive_copy {
257
+ output_vector. push ( "--no-derive-copy" . into ( ) ) ;
258
+ }
259
+
256
260
if !self . options . derive_debug {
257
261
output_vector. push ( "--no-derive-debug" . into ( ) ) ;
258
262
}
@@ -735,6 +739,12 @@ impl Builder {
735
739
self
736
740
}
737
741
742
+ /// Set whether `Copy` should be derived by default.
743
+ pub fn derive_copy ( mut self , doit : bool ) -> Self {
744
+ self . options . derive_copy = doit;
745
+ self
746
+ }
747
+
738
748
/// Set whether `Debug` should be derived by default.
739
749
pub fn derive_debug ( mut self , doit : bool ) -> Self {
740
750
self . options . derive_debug = doit;
@@ -1104,6 +1114,10 @@ pub struct BindgenOptions {
1104
1114
/// True if we should generate layout tests for generated structures.
1105
1115
pub layout_tests : bool ,
1106
1116
1117
+ /// True if we should derive Copy trait implementations for C/C++ structures
1118
+ /// and types.
1119
+ pub derive_copy : bool ,
1120
+
1107
1121
/// True if we should derive Debug trait implementations for C/C++ structures
1108
1122
/// and types.
1109
1123
pub derive_debug : bool ,
@@ -1269,6 +1283,7 @@ impl Default for BindgenOptions {
1269
1283
emit_ir : false ,
1270
1284
emit_ir_graphviz : None ,
1271
1285
layout_tests : true ,
1286
+ derive_copy : true ,
1272
1287
derive_debug : true ,
1273
1288
impl_debug : false ,
1274
1289
derive_default : false ,
Original file line number Diff line number Diff line change 61
61
Arg :: with_name ( "no-layout-tests" )
62
62
. long ( "no-layout-tests" )
63
63
. help ( "Avoid generating layout tests for any type." ) ,
64
+ Arg :: with_name ( "no-derive-copy" )
65
+ . long ( "no-derive-copy" )
66
+ . help ( "Avoid deriving Copy on any type." ) ,
64
67
Arg :: with_name ( "no-derive-debug" )
65
68
. long ( "no-derive-debug" )
66
69
. help ( "Avoid deriving Debug on any type." ) ,
@@ -311,6 +314,10 @@ where
311
314
builder = builder. layout_tests ( false ) ;
312
315
}
313
316
317
+ if matches. is_present ( "no-derive-copy" ) {
318
+ builder = builder. derive_copy ( false ) ;
319
+ }
320
+
314
321
if matches. is_present ( "no-derive-debug" ) {
315
322
builder = builder. derive_debug ( false ) ;
316
323
}
You can’t perform that action at this time.
0 commit comments