@@ -49,13 +49,14 @@ mod godot_version;
49
49
#[ path = "" ]
50
50
mod depend_on_custom {
51
51
use super :: * ;
52
+ use std:: borrow:: Cow ;
52
53
53
54
pub ( crate ) mod godot_exe;
54
55
pub ( crate ) mod godot_version;
55
56
pub ( crate ) mod header_gen;
56
57
57
- pub fn load_gdextension_json ( watch : & mut StopWatch ) -> String {
58
- godot_exe:: load_gdextension_json ( watch)
58
+ pub fn load_gdextension_json ( watch : & mut StopWatch ) -> Cow < ' static , str > {
59
+ Cow :: Owned ( godot_exe:: load_gdextension_json ( watch) )
59
60
}
60
61
61
62
pub fn write_gdextension_headers ( h_path : & Path , rs_path : & Path , watch : & mut StopWatch ) {
@@ -84,19 +85,19 @@ mod depend_on_prebuilt {
84
85
use super :: * ;
85
86
use crate :: import:: prebuilt;
86
87
87
- pub fn load_gdextension_json ( _watch : & mut StopWatch ) -> & ' static str {
88
+ pub fn load_gdextension_json ( _watch : & mut StopWatch ) -> std :: borrow :: Cow < ' static , str > {
88
89
prebuilt:: load_gdextension_json ( )
89
90
}
90
91
91
92
pub fn write_gdextension_headers ( h_path : & Path , rs_path : & Path , watch : & mut StopWatch ) {
92
93
// Note: prebuilt artifacts just return a static str.
93
94
let h_contents = prebuilt:: load_gdextension_header_h ( ) ;
94
- std:: fs:: write ( h_path, h_contents)
95
+ std:: fs:: write ( h_path, h_contents. as_ref ( ) )
95
96
. unwrap_or_else ( |e| panic ! ( "failed to write gdextension_interface.h: {e}" ) ) ;
96
97
watch. record ( "write_header_h" ) ;
97
98
98
99
let rs_contents = prebuilt:: load_gdextension_header_rs ( ) ;
99
- std:: fs:: write ( rs_path, rs_contents)
100
+ std:: fs:: write ( rs_path, rs_contents. as_ref ( ) )
100
101
. unwrap_or_else ( |e| panic ! ( "failed to write gdextension_interface.rs: {e}" ) ) ;
101
102
watch. record ( "write_header_rs" ) ;
102
103
}
0 commit comments