Reimplement std::error::Error for Error.

It was removed with the removal of failure, but like in minidom (#18) it
was probably used by people, so let’s reintroduce it.
This commit is contained in:
Emmanuel Gil Peyrot 2019-09-07 16:08:53 +02:00
parent b244a21e1a
commit 1638288644

View file

@ -15,6 +15,7 @@
//! For usage, check the documentation on the `Jid` struct. //! For usage, check the documentation on the `Jid` struct.
use std::convert::Into; use std::convert::Into;
use std::error::Error as StdError;
use std::fmt; use std::fmt;
use std::str::FromStr; use std::str::FromStr;
@ -35,6 +36,8 @@ pub enum JidParseError {
EmptyResource, EmptyResource,
} }
impl StdError for JidParseError {}
impl fmt::Display for JidParseError { impl fmt::Display for JidParseError {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
write!(fmt, "{}", match self { write!(fmt, "{}", match self {