File tree 2 files changed +21
-4
lines changed
2 files changed +21
-4
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,9 @@ use std::mem;
3
3
use std:: rc:: Rc ;
4
4
5
5
use semver:: Version ;
6
+
7
+ use serde:: { Serialize , Serializer } ;
8
+
6
9
use core:: { Dependency , PackageId , SourceId } ;
7
10
use core:: interning:: InternedString ;
8
11
@@ -190,7 +193,7 @@ fn build_feature_map(
190
193
/// * A feature in a depedency
191
194
///
192
195
/// The selection between these 3 things happens as part of the construction of the FeatureValue.
193
- #[ derive( Clone , Debug , Serialize ) ]
196
+ #[ derive( Clone , Debug ) ]
194
197
pub enum FeatureValue {
195
198
Feature ( InternedString ) ,
196
199
Crate ( InternedString ) ,
@@ -227,4 +230,20 @@ impl FeatureValue {
227
230
}
228
231
}
229
232
233
+ impl Serialize for FeatureValue {
234
+ fn serialize < S > ( & self , serializer : S ) -> Result < S :: Ok , S :: Error >
235
+ where
236
+ S : Serializer ,
237
+ {
238
+ use self :: FeatureValue :: * ;
239
+ match * self {
240
+ Feature ( ref f) => serializer. serialize_str ( f) ,
241
+ Crate ( ref c) => serializer. serialize_str ( c) ,
242
+ CrateFeature ( ref c, ref f) => {
243
+ serializer. serialize_str ( & [ c. as_ref ( ) , f. as_ref ( ) ] . join ( "/" ) )
244
+ }
245
+ }
246
+ }
247
+ }
248
+
230
249
pub type FeatureMap = BTreeMap < String , Vec < FeatureValue > > ;
Original file line number Diff line number Diff line change @@ -192,9 +192,7 @@ optional_feat = []
192
192
],
193
193
"features": {
194
194
"default": [
195
- {
196
- "Feature": "default_feat"
197
- }
195
+ "default_feat"
198
196
],
199
197
"default_feat": [],
200
198
"optional_feat": []
You can’t perform that action at this time.
0 commit comments