mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-06-14 05:51:01 +00:00
Have serde::de::Error require std::error::Error
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
use std::fmt::Debug;
|
||||
use std::fmt;
|
||||
use std::error;
|
||||
use test::Bencher;
|
||||
|
||||
use rustc_serialize::{Decoder, Decodable};
|
||||
@@ -24,6 +26,21 @@ impl serde::de::Error for Error {
|
||||
fn missing_field(_: &'static str) -> Error { Error::SyntaxError }
|
||||
}
|
||||
|
||||
impl fmt::Display for Error {
|
||||
fn fmt(&self, formatter: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||
formatter.write_str(format!("{:?}", self).as_ref())
|
||||
}
|
||||
}
|
||||
|
||||
impl error::Error for Error {
|
||||
fn description(&self) -> &str {
|
||||
"Serde Deserialization Error"
|
||||
}
|
||||
|
||||
fn cause(&self) -> Option<&error::Error> {
|
||||
None
|
||||
}
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
mod decoder {
|
||||
|
||||
Reference in New Issue
Block a user