mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-23 07:08:02 +00:00
Update to rust HEAD
This commit is contained in:
@@ -39,6 +39,8 @@ pub enum ErrorCode {
|
||||
|
||||
impl fmt::Debug for ErrorCode {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
use std::fmt::Debug;
|
||||
|
||||
match *self {
|
||||
//ErrorCode::ConversionError(ref token) => write!(f, "failed to convert {}", token),
|
||||
ErrorCode::EOFWhileParsingList => "EOF While parsing list".fmt(f),
|
||||
@@ -91,7 +93,7 @@ impl error::Error for Error {
|
||||
fn description(&self) -> &str {
|
||||
match *self {
|
||||
Error::SyntaxError(..) => "syntax error",
|
||||
Error::IoError(_) => "input/output error",
|
||||
Error::IoError(ref error) => error.description().as_slice(),
|
||||
/*
|
||||
Error::ExpectedError(ref expected, _) => &expected,
|
||||
Error::MissingFieldError(_) => "missing field",
|
||||
@@ -100,6 +102,13 @@ impl error::Error for Error {
|
||||
}
|
||||
}
|
||||
|
||||
fn cause(&self) -> Option<&error::Error> {
|
||||
match *self {
|
||||
Error::IoError(ref error) => Some(error),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
impl fmt::Display for Error {
|
||||
|
||||
@@ -67,7 +67,7 @@ impl fmt::Debug for Value {
|
||||
|
||||
pub fn to_value<T>(value: &T) -> Value where T: ser::Serialize {
|
||||
let mut writer = Writer::new();
|
||||
writer.visit(value).unwrap();
|
||||
writer.visit(value).ok().unwrap();
|
||||
writer.unwrap()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user