Implement ser::Error for the value error

This commit is contained in:
David Tolnay 2017-04-14 14:40:37 -07:00
parent d10fa2bd86
commit 6a37472023
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82

View File

@ -39,6 +39,7 @@ use lib::*;
use de::{self, IntoDeserializer, Expected, SeqAccess};
use private::de::size_hint;
use ser;
use self::private::{First, Second};
////////////////////////////////////////////////////////////////////////////////
@ -74,6 +75,15 @@ impl de::Error for Error {
}
}
impl ser::Error for Error {
fn custom<T>(msg: T) -> Self
where
T: Display,
{
de::Error::custom(msg)
}
}
impl Display for Error {
#[cfg(any(feature = "std", feature = "collections"))]
fn fmt(&self, formatter: &mut fmt::Formatter) -> Result<(), fmt::Error> {