File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 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> {
233233 }
234234}
235235
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+
236249pub struct Toml {
237250 table : Value ,
238251}
@@ -245,6 +258,12 @@ impl Toml {
245258 . and_then ( |v| v. get ( "release" ) )
246259 . map ( |t| Profile { table : t } )
247260 }
261+
262+ pub fn features ( & self ) -> Option < Features > {
263+ self . table
264+ . get ( "cargo-features" )
265+ . map ( |a| Features { array : a } )
266+ }
248267}
249268
250269pub fn toml ( root : & Path ) -> Result < Toml > {
Original file line number Diff line number Diff line change @@ -76,6 +76,10 @@ fn build_crate(
7676
7777 let target_dir = td. join ( "target" ) ;
7878
79+ if let Some ( features) = ctoml. features ( ) {
80+ stoml. insert_str ( 0 , & features. to_string ( ) )
81+ }
82+
7983 if let Some ( profile) = ctoml. profile ( ) {
8084 stoml. push_str ( & profile. to_string ( ) )
8185 }
You can’t perform that action at this time.
0 commit comments