[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC PATCH 08/25] tools/xenbindgen: Add support for enums in TOML specs



Hello,

> +
>   /// A language-agnostic specification.
>   #[derive(Debug, serde::Deserialize)]
>   struct InFileDef {
>       /// List of structs described in this input specification.
>       structs: Option<Vec<StructDef>>,
> +    /// List of lang-agnostic enumerated descriptions.
> +    enums: Option<Vec<EnumDef>>,
>   }
>   

Alike for struct/..., I think we can merge that with OutFileDef using 
the default attribute in serde :
#[serde(default)]
https://serde.rs/field-attrs.html#default

That way, when there is no structs/... entry in the file, it is parsed 
as a empty vec![] instead of failing which allows us to remove this 
wrapper struct.

Cheers

Teddy



Teddy Astie | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.