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:
Jonas Schäfer 2024-07-01 07:46:02 +02:00
commit 46584f05f9
3 changed files with 34 additions and 7 deletions

View file

@ -329,4 +329,12 @@ impl FieldDef {
}
}
}
/// Return true if this field's parsing consumes text data.
pub(crate) fn is_text_field(&self) -> bool {
match self.kind {
FieldKind::Text { .. } => true,
_ => false,
}
}
}