@@ -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).
@@ -676,7 +674,8 @@ impl Builder {
676
674
. to_str ( )
677
675
. expect ( "Cannot convert current directory name to string" )
678
676
. to_owned ( ) ;
679
- self . input_header_contents
677
+ self . options
678
+ . input_header_contents
680
679
. push ( ( absolute_path, contents. into ( ) ) ) ;
681
680
self
682
681
}
@@ -1533,11 +1532,9 @@ impl Builder {
1533
1532
) ;
1534
1533
1535
1534
state. input_unsaved_files . extend (
1536
- self . input_header_contents
1537
- . drain ( ..)
1538
- . map ( |( name, contents) | {
1539
- clang:: UnsavedFile :: new ( & name, & contents)
1540
- } ) ,
1535
+ self . options . input_header_contents . drain ( ..) . map (
1536
+ |( name, contents) | clang:: UnsavedFile :: new ( & name, & contents) ,
1537
+ ) ,
1541
1538
) ;
1542
1539
1543
1540
Bindings :: generate ( state, self . options )
@@ -1575,7 +1572,7 @@ impl Builder {
1575
1572
1576
1573
// For each input header content, add a prefix line of `#line 0 "$name"`
1577
1574
// followed by the contents.
1578
- for & ( ref name, ref contents) in & self . input_header_contents {
1575
+ for & ( ref name, ref contents) in & self . options . input_header_contents {
1579
1576
is_cpp |= file_is_cpp ( name) ;
1580
1577
1581
1578
wrapper_contents. push_str ( "#line 0 \" " ) ;
@@ -1919,6 +1916,9 @@ struct BindgenOptions {
1919
1916
/// The input header files.
1920
1917
input_headers : Vec < String > ,
1921
1918
1919
+ /// Tuples of unsaved file contents of the form (name, contents).
1920
+ input_header_contents : Vec < ( String , String ) > ,
1921
+
1922
1922
/// Which kind of items should we generate? By default, we'll generate all
1923
1923
/// of them.
1924
1924
codegen_config : CodegenConfig ,
@@ -2102,6 +2102,7 @@ impl Default for BindgenOptions {
2102
2102
module_lines : Default :: default ( ) ,
2103
2103
clang_args : Default :: default ( ) ,
2104
2104
input_headers : Default :: default ( ) ,
2105
+ input_header_contents : Default :: default ( ) ,
2105
2106
codegen_config : CodegenConfig :: all ( ) ,
2106
2107
conservative_inline_namespaces : Default :: default ( ) ,
2107
2108
generate_comments : true ,
0 commit comments