Fix serde.

This commit is contained in:
Stephen Chung 2020-08-06 21:19:54 +08:00
parent b8b1efd241
commit 130bcfe293
2 changed files with 2 additions and 1 deletions

View File

@ -136,6 +136,7 @@ pub fn from_dynamic<'de, T: Deserialize<'de>>(
impl Error for Box<EvalAltResult> { impl Error for Box<EvalAltResult> {
fn custom<T: fmt::Display>(err: T) -> Self { fn custom<T: fmt::Display>(err: T) -> Self {
EvalAltResult::ErrorParsing(ParseErrorType::BadInput(err.to_string()), Position::none()) EvalAltResult::ErrorParsing(ParseErrorType::BadInput(err.to_string()), Position::none())
.into()
} }
} }

View File

@ -99,7 +99,7 @@ pub fn to_dynamic<T: Serialize>(value: T) -> Result<Dynamic, Box<EvalAltResult>>
impl Error for Box<EvalAltResult> { impl Error for Box<EvalAltResult> {
fn custom<T: fmt::Display>(err: T) -> Self { fn custom<T: fmt::Display>(err: T) -> Self {
EvalAltResult::ErrorRuntime(err.to_string(), Position::none()) EvalAltResult::ErrorRuntime(err.to_string(), Position::none()).into()
} }
} }