From 6a3747202382ec63246ce140d636aab76def75e4 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Fri, 14 Apr 2017 14:40:37 -0700 Subject: [PATCH] Implement ser::Error for the value error --- serde/src/de/value.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/serde/src/de/value.rs b/serde/src/de/value.rs index 06e50414..c52b86c9 100644 --- a/serde/src/de/value.rs +++ b/serde/src/de/value.rs @@ -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(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> {