xso-proc: Add n = 1 flag to element meta

This allows exactly one arbitrary payload in any element, and is handled
after every other element with a more specific matcher has been parsed.

Both the #[xml(element(n = 1))] meta and its shortcut #[xml(element)]
are allowed and treated the exact same way.
This commit is contained in:
Emmanuel Gil Peyrot 2024-12-19 20:36:57 +01:00 • committed by Jonas Schäfer
commit c72cf3ddd1
7 changed files with 265 additions and 80 deletions

View file

@ -67,10 +67,9 @@ impl Field for ChildField {
} = scope;
let from_events = from_events_fn(element_ty.clone());
let from_xml_builder = from_xml_builder_ty(element_ty.clone());
let matcher = quote! { #from_events(name, attrs) };
let builder = from_xml_builder;
let builder = from_xml_builder_ty(element_ty.clone());
(
TokenStream::default(),