Skip to content

Commit

Permalink
Merge pull request #1 from termoshtt/serde
Browse files Browse the repository at this point in the history
Generate serde derive
  • Loading branch information
termoshtt authored Nov 16, 2022
2 parents ffdb86a + 976af75 commit c76898c
Show file tree
Hide file tree
Showing 12 changed files with 2,191 additions and 11 deletions.
6 changes: 5 additions & 1 deletion iana-media-types-codegen/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,14 @@ impl MediaType {
let member_idents = &self.member_idents;
let member_templates = &self.member_templates;
quote::quote! {
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[derive(
Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash,
::serde::Serialize, ::serde::Deserialize
)]
pub enum #name {
#(
#[doc = #member_templates]
#[serde(rename = #member_templates)]
#member_idents,
)*
}
Expand Down
5 changes: 5 additions & 0 deletions iana-media-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,8 @@ repository = "https://github.com/termoshtt/iana-media-types"
readme = "../README.md"

[dependencies]
derive_more = "0.99.17"
serde = { version = "1.0", features = ["derive"] }

[dev-dependencies]
serde_json = "1.0.87"
Loading

0 comments on commit c76898c

Please sign in to comment.