1 use serde::{Deserialize, Serialize}; 2 3 pub type Node = clang_ast::Node<Clang>; 4 5 #[derive(Deserialize, Serialize)] 6 pub enum Clang { 7 NamespaceDecl(NamespaceDecl), 8 EnumDecl(EnumDecl), 9 EnumConstantDecl(EnumConstantDecl), 10 ImplicitCastExpr, 11 ConstantExpr(ConstantExpr), 12 Unknown, 13 } 14 15 #[derive(Deserialize, Serialize)] 16 pub struct NamespaceDecl { 17 #[serde(skip_serializing_if = "Option::is_none")] 18 pub name: Option<Box<str>>, 19 } 20 21 #[derive(Deserialize, Serialize)] 22 pub struct EnumDecl { 23 #[serde(skip_serializing_if = "Option::is_none")] 24 pub name: Option<Box<str>>, 25 #[serde( 26 rename = "fixedUnderlyingType", 27 skip_serializing_if = "Option::is_none" 28 )] 29 pub fixed_underlying_type: Option<Type>, 30 } 31 32 #[derive(Deserialize, Serialize)] 33 pub struct EnumConstantDecl { 34 pub name: Box<str>, 35 } 36 37 #[derive(Deserialize, Serialize)] 38 pub struct ConstantExpr { 39 pub value: Box<str>, 40 } 41 42 #[derive(Deserialize, Serialize)] 43 pub struct Type { 44 #[serde(rename = "qualType")] 45 pub qual_type: Box<str>, 46 #[serde(rename = "desugaredQualType", skip_serializing_if = "Option::is_none")] 47 pub desugared_qual_type: Option<Box<str>>, 48 } 49 50 #[cfg(all(test, target_pointer_width = "64"))] 51 const _: [(); core::mem::size_of::<Node>()] = [(); 88]; 52