xso: provide nicer error messages on missing trait implementations
This commit is contained in:
parent
de39f410d5
commit
a222dc70de
2 changed files with 17 additions and 0 deletions
|
|
@ -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>;
|
||||
|
|
|
|||
Loading…
Reference in a new issue