Created
March 11, 2018 16:26
-
-
Save MaikKlein/d36376ad0ff6246e1ef184cf85306b94 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #[derive(Deserialize, Serialize, Debug)] | |
| #[serde(rename_all = "kebab-case")] | |
| pub struct Constant { | |
| pub name: String, | |
| pub notation: Option<Notation>, | |
| pub constant: ConstantEnum, | |
| // Is there an enum representation for those options? | |
| // pub number: Option<i32>, | |
| // pub hex: Option<String>, | |
| // pub bitpos: Option<u32>, | |
| // pub c_expression: Option<CExpression>, | |
| } | |
| #[derive(Deserialize, Serialize, Debug)] | |
| pub enum ConstantEnum { | |
| #[serde(rename = "number")] | |
| Number(i32), | |
| #[serde(rename = "hex")] | |
| Hex(String), | |
| #[serde(rename = "bitpos")] | |
| Bitpos(u32), | |
| #[serde(rename = "c_expression")] | |
| CExpression(CExpression) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment