xso-proc: add support for text codecs

Text codecs allow to customize the conversion of data from/to XML,
in particular in two scenarios:

1. When the type for which the behaviour is to be defined comes from a
   foreign crate, preventing the implementation of
   FromXmlText/IntoXmlText.

2. When there is not one obvious, or more than one sensible, way to
   convert a value to XML text and back.
This commit is contained in:
Jonas Schäfer 2024-06-26 18:26:13 +02:00
commit c83ff286e0
8 changed files with 258 additions and 26 deletions

View file

@ -280,9 +280,9 @@ impl Compound {
State::new(state_name)
.with_field(&bound_name, field.ty())
.with_impl(quote! {
::core::option::Option::Some(::xso::exports::rxml::Event::Text(
#generator.map(|value| ::xso::exports::rxml::Event::Text(
::xso::exports::rxml::parser::EventMetrics::zero(),
#generator,
value,
))
}),
);