mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-17 15:59:25 +00:00
some changes to rustical_xml
This commit is contained in:
@@ -1,39 +1,49 @@
|
||||
use darling::{util::Flag, FromDeriveInput, FromField, FromMeta, FromVariant};
|
||||
use syn::LitByteStr;
|
||||
|
||||
#[derive(Default, FromMeta)]
|
||||
#[derive(Default, FromMeta, Clone)]
|
||||
pub struct ContainerAttrs {
|
||||
pub ns_strict: Flag,
|
||||
}
|
||||
|
||||
#[derive(Default, FromMeta)]
|
||||
#[derive(Default, FromMeta, Clone)]
|
||||
pub struct TagAttrs {
|
||||
pub rename: Option<LitByteStr>,
|
||||
pub ns_strict: Flag,
|
||||
pub ns: Option<LitByteStr>,
|
||||
}
|
||||
|
||||
#[derive(Default, FromVariant)]
|
||||
#[derive(Default, FromVariant, Clone)]
|
||||
#[darling(attributes(xml))]
|
||||
pub struct VariantAttrs {
|
||||
#[darling(flatten)]
|
||||
pub common: TagAttrs,
|
||||
}
|
||||
|
||||
#[derive(Default, FromDeriveInput)]
|
||||
#[derive(Default, FromDeriveInput, Clone)]
|
||||
#[darling(attributes(xml))]
|
||||
pub struct EnumAttrs {
|
||||
#[darling(flatten)]
|
||||
container: ContainerAttrs,
|
||||
}
|
||||
|
||||
#[derive(Default, FromDeriveInput)]
|
||||
#[derive(Default, FromDeriveInput, Clone)]
|
||||
#[darling(attributes(xml))]
|
||||
pub struct StructAttrs {
|
||||
#[darling(flatten)]
|
||||
pub container: ContainerAttrs,
|
||||
|
||||
pub root: Option<LitByteStr>,
|
||||
pub allow_invalid: Flag,
|
||||
}
|
||||
|
||||
#[derive(Default, FromMeta, PartialEq)]
|
||||
pub enum FieldType {
|
||||
#[default]
|
||||
Tag,
|
||||
Attr,
|
||||
Text,
|
||||
Untagged,
|
||||
}
|
||||
|
||||
#[derive(Default, FromField)]
|
||||
@@ -41,8 +51,8 @@ pub struct StructAttrs {
|
||||
pub struct FieldAttrs {
|
||||
#[darling(flatten)]
|
||||
pub common: TagAttrs,
|
||||
pub text: Flag,
|
||||
pub untagged: Flag,
|
||||
pub flatten: Flag,
|
||||
pub default: Option<syn::ExprPath>,
|
||||
#[darling(default, rename = "ty")]
|
||||
pub xml_ty: FieldType,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user