mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-22 20:38:02 +00:00
Merge pull request #162 from skade/std-error
Have serde::de::Error require std::error::Error
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
use serde;
|
||||
use std::fmt;
|
||||
use std::error;
|
||||
use serde::Serialize;
|
||||
use serde::bytes::{ByteBuf, Bytes};
|
||||
|
||||
@@ -17,6 +19,22 @@ impl serde::de::Error for Error {
|
||||
fn missing_field(_field: &'static str) -> Error { Error }
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
struct BytesSerializer {
|
||||
|
||||
Reference in New Issue
Block a user