xso: add support for ignoring unknown attributes

This commit is contained in:
Jonas Schäfer 2024-10-03 12:29:10 +02:00 committed by Link Mauve
commit 290460ba9d
9 changed files with 185 additions and 23 deletions

View file

@ -69,6 +69,7 @@ impl StructInner {
debug,
builder,
iterator,
on_unknown_attribute,
transparent,
} = meta;
@ -84,6 +85,7 @@ impl StructInner {
if let Flag::Present(_) = transparent {
reject_key!(namespace not on "transparent structs");
reject_key!(name not on "transparent structs");
reject_key!(on_unknown_attribute not on "transparent structs");
let fields_span = fields.span();
let fields = match fields {
@ -143,7 +145,7 @@ impl StructInner {
};
Ok(Self::Compound {
inner: Compound::from_fields(fields, &xml_namespace)?,
inner: Compound::from_fields(fields, &xml_namespace, on_unknown_attribute)?,
xml_namespace,
xml_name,
})