xso: provide nicer error messages on missing trait implementations

This commit is contained in:
Jonas Schäfer 2025-05-02 16:57:08 +02:00
commit a222dc70de
2 changed files with 17 additions and 0 deletions

View file

@ -265,6 +265,9 @@ convert_via_fromstr_and_display! {
/// The codec to use for a text can be specified in the attributes understood
/// by `FromXml` and `AsXml` derive macros. See the documentation of the
/// [`FromXml`][`macro@crate::FromXml`] derive macro for details.
#[diagnostic::on_unimplemented(
message = "`{Self}` cannot be used as XML text codec for values of type `{T}`."
)]
pub trait TextCodec<T> {
/// Decode a string value into the type.
fn decode(&self, s: String) -> Result<T, Error>;