mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-23 16:28:02 +00:00
Update for rustc 1.0.0-nightly (8903c21d6 2015-01-15 22:42:58 +0000)
This commit is contained in:
+12
-3
@@ -3,6 +3,7 @@ use std::fmt;
|
||||
use std::io::{ByRefWriter, IoResult};
|
||||
use std::io;
|
||||
use std::str;
|
||||
use std::string::ToString;
|
||||
use std::vec;
|
||||
|
||||
use de::{self, Token, TokenKind};
|
||||
@@ -207,6 +208,14 @@ impl Value {
|
||||
}
|
||||
}
|
||||
|
||||
impl ToString for Value {
|
||||
fn to_string(&self) -> String {
|
||||
let mut wr = Vec::new();
|
||||
self.to_writer(wr.by_ref()).unwrap();
|
||||
str::from_utf8(wr.as_slice()).unwrap().to_string()
|
||||
}
|
||||
}
|
||||
|
||||
struct WriterFormatter<'a, 'b: 'a> {
|
||||
inner: &'a mut fmt::Formatter<'b>,
|
||||
}
|
||||
@@ -449,7 +458,7 @@ impl de::Deserializer<Error> for Deserializer {
|
||||
return Err(
|
||||
Error::ExpectedError(
|
||||
"Array".to_string(),
|
||||
format!("{} => {}", key, value)
|
||||
format!("{:?} => {:?}", key, value)
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -464,7 +473,7 @@ impl de::Deserializer<Error> for Deserializer {
|
||||
return Err(
|
||||
Error::ExpectedError(
|
||||
"None".to_string(),
|
||||
format!("{} => {}", key, value)
|
||||
format!("{:?} => {:?}", key, value)
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -483,7 +492,7 @@ impl de::Deserializer<Error> for Deserializer {
|
||||
return Err(
|
||||
Error::ExpectedError(
|
||||
"String or Object".to_string(),
|
||||
format!("{}", token)
|
||||
format!("{:?}", token)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user