Condense representation of variants in json
diff --git a/codegen/src/parse.rs b/codegen/src/parse.rs
index cdfc7e0..c7a087d 100644
--- a/codegen/src/parse.rs
+++ b/codegen/src/parse.rs
@@ -72,7 +72,7 @@
item: &syn::DataEnum,
items: &ItemLookup,
tokens: &TokenLookup,
-) -> Vec<types::Variant> {
+) -> types::Variants {
item.variants
.iter()
.map(|variant| {
@@ -86,10 +86,7 @@
_ => panic!("Enum representation not supported"),
};
- types::Variant {
- ident: variant.ident.to_string(),
- fields,
- }
+ (variant.ident.to_string(), fields)
})
.collect()
}
@@ -98,7 +95,7 @@
item: &syn::DataStruct,
items: &ItemLookup,
tokens: &TokenLookup,
-) -> IndexMap<String, types::Type> {
+) -> types::Fields {
match &item.fields {
syn::Fields::Named(fields) => fields
.named