@@ -522,6 +522,20 @@ impl Builder {
522
522
} )
523
523
. count ( ) ;
524
524
525
+ self . options
526
+ . no_copy_types
527
+ . get_items ( )
528
+ . iter ( )
529
+ . map ( |item| {
530
+ output_vector. push ( "--no-copy" . into ( ) ) ;
531
+ output_vector. push (
532
+ item. trim_left_matches ( "^" )
533
+ . trim_right_matches ( "$" )
534
+ . into ( ) ,
535
+ ) ;
536
+ } )
537
+ . count ( ) ;
538
+
525
539
output_vector
526
540
}
527
541
@@ -1158,6 +1172,13 @@ impl Builder {
1158
1172
self . options . no_partialeq_types . insert ( arg) ;
1159
1173
self
1160
1174
}
1175
+
1176
+ /// Don't derive `Copy` for a given type. Regular
1177
+ /// expressions are supported.
1178
+ pub fn no_copy ( mut self , arg : String ) -> Self {
1179
+ self . options . no_copy_types . insert ( arg) ;
1180
+ self
1181
+ }
1161
1182
}
1162
1183
1163
1184
/// Configuration options for generated bindings.
@@ -1345,6 +1366,9 @@ struct BindgenOptions {
1345
1366
1346
1367
/// The set of types that we should not derive `PartialEq` for.
1347
1368
no_partialeq_types : RegexSet ,
1369
+
1370
+ /// The set of types that we should not derive `Copy` for.
1371
+ no_copy_types : RegexSet ,
1348
1372
}
1349
1373
1350
1374
/// TODO(emilio): This is sort of a lie (see the error message that results from
@@ -1363,6 +1387,7 @@ impl BindgenOptions {
1363
1387
self . constified_enum_modules . build ( ) ;
1364
1388
self . rustified_enums . build ( ) ;
1365
1389
self . no_partialeq_types . build ( ) ;
1390
+ self . no_copy_types . build ( ) ;
1366
1391
}
1367
1392
1368
1393
/// Update rust target version
@@ -1434,6 +1459,7 @@ impl Default for BindgenOptions {
1434
1459
rustfmt_bindings : true ,
1435
1460
rustfmt_configuration_file : None ,
1436
1461
no_partialeq_types : Default :: default ( ) ,
1462
+ no_copy_types : Default :: default ( ) ,
1437
1463
}
1438
1464
}
1439
1465
}
0 commit comments