File tree 2 files changed +23
-0
lines changed
2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -233,6 +233,19 @@ impl<'t> fmt::Display for Profile<'t> {
233
233
}
234
234
}
235
235
236
+ pub struct Features < ' a > {
237
+ array : & ' a Value ,
238
+ }
239
+
240
+ impl < ' a > fmt:: Display for Features < ' a > {
241
+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
242
+ let mut map = toml:: map:: Map :: new ( ) ;
243
+ map. insert ( "cargo-features" . to_owned ( ) , self . array . clone ( ) ) ;
244
+
245
+ fmt:: Display :: fmt ( & Value :: Table ( map) , f)
246
+ }
247
+ }
248
+
236
249
pub struct Toml {
237
250
table : Value ,
238
251
}
@@ -245,6 +258,12 @@ impl Toml {
245
258
. and_then ( |v| v. get ( "release" ) )
246
259
. map ( |t| Profile { table : t } )
247
260
}
261
+
262
+ pub fn features ( & self ) -> Option < Features > {
263
+ self . table
264
+ . get ( "cargo-features" )
265
+ . map ( |a| Features { array : a } )
266
+ }
248
267
}
249
268
250
269
pub fn toml ( root : & Path ) -> Result < Toml > {
Original file line number Diff line number Diff line change @@ -76,6 +76,10 @@ fn build_crate(
76
76
77
77
let target_dir = td. join ( "target" ) ;
78
78
79
+ if let Some ( features) = ctoml. features ( ) {
80
+ stoml. insert_str ( 0 , & features. to_string ( ) )
81
+ }
82
+
79
83
if let Some ( profile) = ctoml. profile ( ) {
80
84
stoml. push_str ( & profile. to_string ( ) )
81
85
}
You can’t perform that action at this time.
0 commit comments