xso: refine handling of multiple #[xml(text)] fields
Previously, we only enforced the existence of at most one `#[xml(text)]` field only at code generation time for `FromXml`. This change enforces it at parsing time, which is more consistent and allows for a clearer error message.
This commit is contained in:
parent
ae30221e3c
commit
46584f05f9
3 changed files with 34 additions and 7 deletions
|
|
@ -140,7 +140,9 @@ The `text` meta causes the field to be mapped to the text content of the
|
|||
element. For `FromXml`, the field's type must implement [`FromXmlText`] and
|
||||
for `IntoXml`, the field's type must implement [`IntoXmlText`].
|
||||
|
||||
The `text` meta supports no options or value.
|
||||
The `text` meta supports no options or value. Only a single field per struct
|
||||
may be annotated with `#[xml(text)]` at a time, to avoid parsing ambiguities.
|
||||
This is also true if only `IntoXml` is derived on a field, for consistency.
|
||||
|
||||
##### Example
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue