@@ -225,8 +225,6 @@ impl Default for CodegenConfig {
225
225
pub struct Builder {
226
226
parse_callbacks : Option < Box < dyn callbacks:: ParseCallbacks > > ,
227
227
options : BindgenOptions ,
228
- // Tuples of unsaved file contents of the form (name, contents).
229
- input_header_contents : Vec < ( String , String ) > ,
230
228
}
231
229
232
230
/// Construct a new [`Builder`](./struct.Builder.html).
@@ -667,7 +665,8 @@ impl Builder {
667
665
. to_str ( )
668
666
. expect ( "Cannot convert current directory name to string" )
669
667
. to_owned ( ) ;
670
- self . input_header_contents
668
+ self . options
669
+ . input_header_contents
671
670
. push ( ( absolute_path, contents. into ( ) ) ) ;
672
671
self
673
672
}
@@ -1512,11 +1511,9 @@ impl Builder {
1512
1511
) ;
1513
1512
1514
1513
state. input_unsaved_files . extend (
1515
- self . input_header_contents
1516
- . drain ( ..)
1517
- . map ( |( name, contents) | {
1518
- clang:: UnsavedFile :: new ( & name, & contents)
1519
- } ) ,
1514
+ self . options . input_header_contents . drain ( ..) . map (
1515
+ |( name, contents) | clang:: UnsavedFile :: new ( & name, & contents) ,
1516
+ ) ,
1520
1517
) ;
1521
1518
1522
1519
Bindings :: generate ( state, self . options )
@@ -1554,7 +1551,7 @@ impl Builder {
1554
1551
1555
1552
// For each input header content, add a prefix line of `#line 0 "$name"`
1556
1553
// followed by the contents.
1557
- for & ( ref name, ref contents) in & self . input_header_contents {
1554
+ for & ( ref name, ref contents) in & self . options . input_header_contents {
1558
1555
is_cpp |= file_is_cpp ( name) ;
1559
1556
1560
1557
wrapper_contents. push_str ( "#line 0 \" " ) ;
@@ -1895,6 +1892,9 @@ struct BindgenOptions {
1895
1892
/// The input header files.
1896
1893
input_headers : Vec < String > ,
1897
1894
1895
+ /// Tuples of unsaved file contents of the form (name, contents).
1896
+ input_header_contents : Vec < ( String , String ) > ,
1897
+
1898
1898
/// Which kind of items should we generate? By default, we'll generate all
1899
1899
/// of them.
1900
1900
codegen_config : CodegenConfig ,
@@ -2077,6 +2077,7 @@ impl Default for BindgenOptions {
2077
2077
module_lines : Default :: default ( ) ,
2078
2078
clang_args : Default :: default ( ) ,
2079
2079
input_headers : Default :: default ( ) ,
2080
+ input_header_contents : Default :: default ( ) ,
2080
2081
codegen_config : CodegenConfig :: all ( ) ,
2081
2082
conservative_inline_namespaces : Default :: default ( ) ,
2082
2083
generate_comments : true ,
0 commit comments