Merge pull request #17 from danburkert/master
Update for rustc 1.0.0-nightly (8903c21d6 2015-01-15 22:42:58 +0000)
This commit is contained in:
commit
abc92da944
@ -72,13 +72,13 @@ mod decoder {
|
|||||||
|
|
||||||
// Primitive types:
|
// Primitive types:
|
||||||
fn read_nil(&mut self) -> Result<(), Error> { Err(SyntaxError) }
|
fn read_nil(&mut self) -> Result<(), Error> { Err(SyntaxError) }
|
||||||
fn read_uint(&mut self) -> Result<uint, Error> { Err(SyntaxError) }
|
fn read_usize(&mut self) -> Result<uint, Error> { Err(SyntaxError) }
|
||||||
fn read_u64(&mut self) -> Result<u64, Error> { Err(SyntaxError) }
|
fn read_u64(&mut self) -> Result<u64, Error> { Err(SyntaxError) }
|
||||||
fn read_u32(&mut self) -> Result<u32, Error> { Err(SyntaxError) }
|
fn read_u32(&mut self) -> Result<u32, Error> { Err(SyntaxError) }
|
||||||
fn read_u16(&mut self) -> Result<u16, Error> { Err(SyntaxError) }
|
fn read_u16(&mut self) -> Result<u16, Error> { Err(SyntaxError) }
|
||||||
fn read_u8(&mut self) -> Result<u8, Error> { Err(SyntaxError) }
|
fn read_u8(&mut self) -> Result<u8, Error> { Err(SyntaxError) }
|
||||||
#[inline]
|
#[inline]
|
||||||
fn read_int(&mut self) -> Result<int, Error> {
|
fn read_isize(&mut self) -> Result<int, Error> {
|
||||||
match self.stack.pop() {
|
match self.stack.pop() {
|
||||||
Some(IntState(x)) => Ok(x),
|
Some(IntState(x)) => Ok(x),
|
||||||
_ => Err(SyntaxError),
|
_ => Err(SyntaxError),
|
||||||
|
@ -52,7 +52,7 @@ impl rustc_serialize::Encodable for HttpProtocol {
|
|||||||
|
|
||||||
impl rustc_serialize::Decodable for HttpProtocol {
|
impl rustc_serialize::Decodable for HttpProtocol {
|
||||||
fn decode<D: rustc_serialize::Decoder>(d: &mut D) -> Result<HttpProtocol, D::Error> {
|
fn decode<D: rustc_serialize::Decoder>(d: &mut D) -> Result<HttpProtocol, D::Error> {
|
||||||
match FromPrimitive::from_uint(try!(d.read_uint())) {
|
match FromPrimitive::from_uint(try!(d.read_usize())) {
|
||||||
Some(value) => Ok(value),
|
Some(value) => Ok(value),
|
||||||
None => Err(d.error("cannot convert from uint")),
|
None => Err(d.error("cannot convert from uint")),
|
||||||
}
|
}
|
||||||
@ -96,7 +96,7 @@ impl rustc_serialize::Encodable for HttpMethod {
|
|||||||
|
|
||||||
impl rustc_serialize::Decodable for HttpMethod {
|
impl rustc_serialize::Decodable for HttpMethod {
|
||||||
fn decode<D: rustc_serialize::Decoder>(d: &mut D) -> Result<HttpMethod, D::Error> {
|
fn decode<D: rustc_serialize::Decoder>(d: &mut D) -> Result<HttpMethod, D::Error> {
|
||||||
match FromPrimitive::from_uint(try!(d.read_uint())) {
|
match FromPrimitive::from_uint(try!(d.read_usize())) {
|
||||||
Some(value) => Ok(value),
|
Some(value) => Ok(value),
|
||||||
None => Err(d.error("cannot convert from uint")),
|
None => Err(d.error("cannot convert from uint")),
|
||||||
}
|
}
|
||||||
@ -133,7 +133,7 @@ impl rustc_serialize::Encodable for CacheStatus {
|
|||||||
|
|
||||||
impl rustc_serialize::Decodable for CacheStatus {
|
impl rustc_serialize::Decodable for CacheStatus {
|
||||||
fn decode<D: rustc_serialize::Decoder>(d: &mut D) -> Result<CacheStatus, D::Error> {
|
fn decode<D: rustc_serialize::Decoder>(d: &mut D) -> Result<CacheStatus, D::Error> {
|
||||||
match FromPrimitive::from_uint(try!(d.read_uint())) {
|
match FromPrimitive::from_uint(try!(d.read_usize())) {
|
||||||
Some(value) => Ok(value),
|
Some(value) => Ok(value),
|
||||||
None => Err(d.error("cannot convert from uint")),
|
None => Err(d.error("cannot convert from uint")),
|
||||||
}
|
}
|
||||||
@ -179,7 +179,7 @@ impl rustc_serialize::Encodable for OriginProtocol {
|
|||||||
|
|
||||||
impl rustc_serialize::Decodable for OriginProtocol {
|
impl rustc_serialize::Decodable for OriginProtocol {
|
||||||
fn decode<D: rustc_serialize::Decoder>(d: &mut D) -> Result<OriginProtocol, D::Error> {
|
fn decode<D: rustc_serialize::Decoder>(d: &mut D) -> Result<OriginProtocol, D::Error> {
|
||||||
match FromPrimitive::from_uint(try!(d.read_uint())) {
|
match FromPrimitive::from_uint(try!(d.read_usize())) {
|
||||||
Some(value) => Ok(value),
|
Some(value) => Ok(value),
|
||||||
None => Err(d.error("cannot convert from uint")),
|
None => Err(d.error("cannot convert from uint")),
|
||||||
}
|
}
|
||||||
@ -217,7 +217,7 @@ impl rustc_serialize::Encodable for ZonePlan {
|
|||||||
|
|
||||||
impl rustc_serialize::Decodable for ZonePlan {
|
impl rustc_serialize::Decodable for ZonePlan {
|
||||||
fn decode<D: rustc_serialize::Decoder>(d: &mut D) -> Result<ZonePlan, D::Error> {
|
fn decode<D: rustc_serialize::Decoder>(d: &mut D) -> Result<ZonePlan, D::Error> {
|
||||||
match FromPrimitive::from_uint(try!(d.read_uint())) {
|
match FromPrimitive::from_uint(try!(d.read_usize())) {
|
||||||
Some(value) => Ok(value),
|
Some(value) => Ok(value),
|
||||||
None => Err(d.error("cannot convert from uint")),
|
None => Err(d.error("cannot convert from uint")),
|
||||||
}
|
}
|
||||||
@ -506,7 +506,7 @@ impl rustc_serialize::Encodable for Country {
|
|||||||
|
|
||||||
impl rustc_serialize::Decodable for Country {
|
impl rustc_serialize::Decodable for Country {
|
||||||
fn decode<D: rustc_serialize::Decoder>(d: &mut D) -> Result<Country, D::Error> {
|
fn decode<D: rustc_serialize::Decoder>(d: &mut D) -> Result<Country, D::Error> {
|
||||||
match FromPrimitive::from_uint(try!(d.read_uint())) {
|
match FromPrimitive::from_uint(try!(d.read_usize())) {
|
||||||
Some(value) => Ok(value),
|
Some(value) => Ok(value),
|
||||||
None => Err(d.error("cannot convert from uint")),
|
None => Err(d.error("cannot convert from uint")),
|
||||||
}
|
}
|
||||||
|
@ -66,13 +66,13 @@ mod decoder {
|
|||||||
|
|
||||||
// Primitive types:
|
// Primitive types:
|
||||||
fn read_nil(&mut self) -> Result<(), Error> { Err(SyntaxError) }
|
fn read_nil(&mut self) -> Result<(), Error> { Err(SyntaxError) }
|
||||||
fn read_uint(&mut self) -> Result<uint, Error> { Err(SyntaxError) }
|
fn read_usize(&mut self) -> Result<uint, Error> { Err(SyntaxError) }
|
||||||
fn read_u64(&mut self) -> Result<u64, Error> { Err(SyntaxError) }
|
fn read_u64(&mut self) -> Result<u64, Error> { Err(SyntaxError) }
|
||||||
fn read_u32(&mut self) -> Result<u32, Error> { Err(SyntaxError) }
|
fn read_u32(&mut self) -> Result<u32, Error> { Err(SyntaxError) }
|
||||||
fn read_u16(&mut self) -> Result<u16, Error> { Err(SyntaxError) }
|
fn read_u16(&mut self) -> Result<u16, Error> { Err(SyntaxError) }
|
||||||
fn read_u8(&mut self) -> Result<u8, Error> { Err(SyntaxError) }
|
fn read_u8(&mut self) -> Result<u8, Error> { Err(SyntaxError) }
|
||||||
#[inline]
|
#[inline]
|
||||||
fn read_int(&mut self) -> Result<int, Error> {
|
fn read_isize(&mut self) -> Result<int, Error> {
|
||||||
match self.stack.pop() {
|
match self.stack.pop() {
|
||||||
Some(IntValue(x)) => Ok(x),
|
Some(IntValue(x)) => Ok(x),
|
||||||
Some(_) => Err(SyntaxError),
|
Some(_) => Err(SyntaxError),
|
||||||
|
@ -107,7 +107,7 @@ mod decoder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[inline]
|
#[inline]
|
||||||
fn read_uint(&mut self) -> Result<uint, Error> {
|
fn read_usize(&mut self) -> Result<uint, Error> {
|
||||||
match self.stack.pop() {
|
match self.stack.pop() {
|
||||||
Some(UintState(value)) => Ok(value),
|
Some(UintState(value)) => Ok(value),
|
||||||
_ => Err(Error::SyntaxError("UintState".to_string())),
|
_ => Err(Error::SyntaxError("UintState".to_string())),
|
||||||
@ -117,7 +117,7 @@ mod decoder {
|
|||||||
fn read_u32(&mut self) -> Result<u32, Error> { Err(Error::SyntaxError("".to_string())) }
|
fn read_u32(&mut self) -> Result<u32, Error> { Err(Error::SyntaxError("".to_string())) }
|
||||||
fn read_u16(&mut self) -> Result<u16, Error> { Err(Error::SyntaxError("".to_string())) }
|
fn read_u16(&mut self) -> Result<u16, Error> { Err(Error::SyntaxError("".to_string())) }
|
||||||
fn read_u8(&mut self) -> Result<u8, Error> { Err(Error::SyntaxError("".to_string())) }
|
fn read_u8(&mut self) -> Result<u8, Error> { Err(Error::SyntaxError("".to_string())) }
|
||||||
fn read_int(&mut self) -> Result<int, Error> { Err(Error::SyntaxError("".to_string())) }
|
fn read_isize(&mut self) -> Result<int, Error> { Err(Error::SyntaxError("".to_string())) }
|
||||||
fn read_i64(&mut self) -> Result<i64, Error> { Err(Error::SyntaxError("".to_string())) }
|
fn read_i64(&mut self) -> Result<i64, Error> { Err(Error::SyntaxError("".to_string())) }
|
||||||
fn read_i32(&mut self) -> Result<i32, Error> { Err(Error::SyntaxError("".to_string())) }
|
fn read_i32(&mut self) -> Result<i32, Error> { Err(Error::SyntaxError("".to_string())) }
|
||||||
fn read_i16(&mut self) -> Result<i16, Error> { Err(Error::SyntaxError("".to_string())) }
|
fn read_i16(&mut self) -> Result<i16, Error> { Err(Error::SyntaxError("".to_string())) }
|
||||||
@ -440,17 +440,17 @@ mod deserializer {
|
|||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn syntax_error(&mut self, token: de::Token, expected: &[de::TokenKind]) -> Error {
|
fn syntax_error(&mut self, token: de::Token, expected: &[de::TokenKind]) -> Error {
|
||||||
Error::SyntaxError(format!("expected {}, found {}", expected, token))
|
Error::SyntaxError(format!("expected {:?}, found {:?}", expected, token))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn unexpected_name_error(&mut self, token: de::Token) -> Error {
|
fn unexpected_name_error(&mut self, token: de::Token) -> Error {
|
||||||
Error::UnexpectedName(format!("found {}", token))
|
Error::UnexpectedName(format!("found {:?}", token))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn conversion_error(&mut self, token: de::Token) -> Error {
|
fn conversion_error(&mut self, token: de::Token) -> Error {
|
||||||
Error::UnexpectedName(format!("found {}", token))
|
Error::UnexpectedName(format!("found {:?}", token))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -56,13 +56,13 @@ mod decoder {
|
|||||||
|
|
||||||
// Primitive types:
|
// Primitive types:
|
||||||
fn read_nil(&mut self) -> Result<(), Error> { Err(SyntaxError) }
|
fn read_nil(&mut self) -> Result<(), Error> { Err(SyntaxError) }
|
||||||
fn read_uint(&mut self) -> Result<uint, Error> { Err(SyntaxError) }
|
fn read_usize(&mut self) -> Result<uint, Error> { Err(SyntaxError) }
|
||||||
fn read_u64(&mut self) -> Result<u64, Error> { Err(SyntaxError) }
|
fn read_u64(&mut self) -> Result<u64, Error> { Err(SyntaxError) }
|
||||||
fn read_u32(&mut self) -> Result<u32, Error> { Err(SyntaxError) }
|
fn read_u32(&mut self) -> Result<u32, Error> { Err(SyntaxError) }
|
||||||
fn read_u16(&mut self) -> Result<u16, Error> { Err(SyntaxError) }
|
fn read_u16(&mut self) -> Result<u16, Error> { Err(SyntaxError) }
|
||||||
fn read_u8(&mut self) -> Result<u8, Error> { Err(SyntaxError) }
|
fn read_u8(&mut self) -> Result<u8, Error> { Err(SyntaxError) }
|
||||||
#[inline]
|
#[inline]
|
||||||
fn read_int(&mut self) -> Result<int, Error> {
|
fn read_isize(&mut self) -> Result<int, Error> {
|
||||||
match self.iter.next() {
|
match self.iter.next() {
|
||||||
Some(value) => Ok(value),
|
Some(value) => Ok(value),
|
||||||
None => Err(EndOfStream),
|
None => Err(EndOfStream),
|
||||||
@ -210,7 +210,7 @@ mod decoder {
|
|||||||
|
|
||||||
// Primitive types:
|
// Primitive types:
|
||||||
fn read_nil(&mut self) -> Result<(), Error> { Err(SyntaxError) }
|
fn read_nil(&mut self) -> Result<(), Error> { Err(SyntaxError) }
|
||||||
fn read_uint(&mut self) -> Result<uint, Error> { Err(SyntaxError) }
|
fn read_usize(&mut self) -> Result<uint, Error> { Err(SyntaxError) }
|
||||||
fn read_u64(&mut self) -> Result<u64, Error> { Err(SyntaxError) }
|
fn read_u64(&mut self) -> Result<u64, Error> { Err(SyntaxError) }
|
||||||
fn read_u32(&mut self) -> Result<u32, Error> { Err(SyntaxError) }
|
fn read_u32(&mut self) -> Result<u32, Error> { Err(SyntaxError) }
|
||||||
fn read_u16(&mut self) -> Result<u16, Error> { Err(SyntaxError) }
|
fn read_u16(&mut self) -> Result<u16, Error> { Err(SyntaxError) }
|
||||||
@ -222,7 +222,7 @@ mod decoder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[inline]
|
#[inline]
|
||||||
fn read_int(&mut self) -> Result<int, Error> { Err(SyntaxError) }
|
fn read_isize(&mut self) -> Result<int, Error> { Err(SyntaxError) }
|
||||||
fn read_i64(&mut self) -> Result<i64, Error> { Err(SyntaxError) }
|
fn read_i64(&mut self) -> Result<i64, Error> { Err(SyntaxError) }
|
||||||
fn read_i32(&mut self) -> Result<i32, Error> { Err(SyntaxError) }
|
fn read_i32(&mut self) -> Result<i32, Error> { Err(SyntaxError) }
|
||||||
fn read_i16(&mut self) -> Result<i16, Error> { Err(SyntaxError) }
|
fn read_i16(&mut self) -> Result<i16, Error> { Err(SyntaxError) }
|
||||||
|
4
serde2/Cargo.lock
generated
4
serde2/Cargo.lock
generated
@ -2,13 +2,13 @@
|
|||||||
name = "serde2"
|
name = "serde2"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"rustc-serialize 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc-serialize 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde2_macros 0.1.0",
|
"serde2_macros 0.1.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustc-serialize"
|
name = "rustc-serialize"
|
||||||
version = "0.2.6"
|
version = "0.2.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -157,7 +157,7 @@ impl rustc_serialize::Encodable for HttpProtocol {
|
|||||||
|
|
||||||
impl rustc_serialize::Decodable for HttpProtocol {
|
impl rustc_serialize::Decodable for HttpProtocol {
|
||||||
fn decode<D: rustc_serialize::Decoder>(d: &mut D) -> Result<HttpProtocol, D::Error> {
|
fn decode<D: rustc_serialize::Decoder>(d: &mut D) -> Result<HttpProtocol, D::Error> {
|
||||||
match FromPrimitive::from_uint(try!(d.read_uint())) {
|
match FromPrimitive::from_uint(try!(d.read_usize())) {
|
||||||
Some(value) => Ok(value),
|
Some(value) => Ok(value),
|
||||||
None => Err(d.error("cannot convert from uint")),
|
None => Err(d.error("cannot convert from uint")),
|
||||||
}
|
}
|
||||||
@ -209,7 +209,7 @@ impl rustc_serialize::Encodable for HttpMethod {
|
|||||||
|
|
||||||
impl rustc_serialize::Decodable for HttpMethod {
|
impl rustc_serialize::Decodable for HttpMethod {
|
||||||
fn decode<D: rustc_serialize::Decoder>(d: &mut D) -> Result<HttpMethod, D::Error> {
|
fn decode<D: rustc_serialize::Decoder>(d: &mut D) -> Result<HttpMethod, D::Error> {
|
||||||
match FromPrimitive::from_uint(try!(d.read_uint())) {
|
match FromPrimitive::from_uint(try!(d.read_usize())) {
|
||||||
Some(value) => Ok(value),
|
Some(value) => Ok(value),
|
||||||
None => Err(d.error("cannot convert from uint")),
|
None => Err(d.error("cannot convert from uint")),
|
||||||
}
|
}
|
||||||
@ -254,7 +254,7 @@ impl rustc_serialize::Encodable for CacheStatus {
|
|||||||
|
|
||||||
impl rustc_serialize::Decodable for CacheStatus {
|
impl rustc_serialize::Decodable for CacheStatus {
|
||||||
fn decode<D: rustc_serialize::Decoder>(d: &mut D) -> Result<CacheStatus, D::Error> {
|
fn decode<D: rustc_serialize::Decoder>(d: &mut D) -> Result<CacheStatus, D::Error> {
|
||||||
match FromPrimitive::from_uint(try!(d.read_uint())) {
|
match FromPrimitive::from_uint(try!(d.read_usize())) {
|
||||||
Some(value) => Ok(value),
|
Some(value) => Ok(value),
|
||||||
None => Err(d.error("cannot convert from uint")),
|
None => Err(d.error("cannot convert from uint")),
|
||||||
}
|
}
|
||||||
@ -386,7 +386,7 @@ impl rustc_serialize::Encodable for OriginProtocol {
|
|||||||
|
|
||||||
impl rustc_serialize::Decodable for OriginProtocol {
|
impl rustc_serialize::Decodable for OriginProtocol {
|
||||||
fn decode<D: rustc_serialize::Decoder>(d: &mut D) -> Result<OriginProtocol, D::Error> {
|
fn decode<D: rustc_serialize::Decoder>(d: &mut D) -> Result<OriginProtocol, D::Error> {
|
||||||
match FromPrimitive::from_uint(try!(d.read_uint())) {
|
match FromPrimitive::from_uint(try!(d.read_usize())) {
|
||||||
Some(value) => Ok(value),
|
Some(value) => Ok(value),
|
||||||
None => Err(d.error("cannot convert from uint")),
|
None => Err(d.error("cannot convert from uint")),
|
||||||
}
|
}
|
||||||
@ -429,7 +429,7 @@ impl rustc_serialize::Encodable for ZonePlan {
|
|||||||
|
|
||||||
impl rustc_serialize::Decodable for ZonePlan {
|
impl rustc_serialize::Decodable for ZonePlan {
|
||||||
fn decode<D: rustc_serialize::Decoder>(d: &mut D) -> Result<ZonePlan, D::Error> {
|
fn decode<D: rustc_serialize::Decoder>(d: &mut D) -> Result<ZonePlan, D::Error> {
|
||||||
match FromPrimitive::from_uint(try!(d.read_uint())) {
|
match FromPrimitive::from_uint(try!(d.read_usize())) {
|
||||||
Some(value) => Ok(value),
|
Some(value) => Ok(value),
|
||||||
None => Err(d.error("cannot convert from uint")),
|
None => Err(d.error("cannot convert from uint")),
|
||||||
}
|
}
|
||||||
@ -723,7 +723,7 @@ impl rustc_serialize::Encodable for Country {
|
|||||||
|
|
||||||
impl rustc_serialize::Decodable for Country {
|
impl rustc_serialize::Decodable for Country {
|
||||||
fn decode<D: rustc_serialize::Decoder>(d: &mut D) -> Result<Country, D::Error> {
|
fn decode<D: rustc_serialize::Decoder>(d: &mut D) -> Result<Country, D::Error> {
|
||||||
match FromPrimitive::from_uint(try!(d.read_uint())) {
|
match FromPrimitive::from_uint(try!(d.read_usize())) {
|
||||||
Some(value) => Ok(value),
|
Some(value) => Ok(value),
|
||||||
None => Err(d.error("cannot convert from uint")),
|
None => Err(d.error("cannot convert from uint")),
|
||||||
}
|
}
|
||||||
|
@ -49,12 +49,12 @@ use rustc::plugin::Registry;
|
|||||||
pub fn plugin_registrar(reg: &mut Registry) {
|
pub fn plugin_registrar(reg: &mut Registry) {
|
||||||
reg.register_syntax_extension(
|
reg.register_syntax_extension(
|
||||||
token::intern("derive_serialize"),
|
token::intern("derive_serialize"),
|
||||||
Decorator(box expand_derive_serialize));
|
Decorator(Box::new(expand_derive_serialize)));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
reg.register_syntax_extension(
|
reg.register_syntax_extension(
|
||||||
token::intern("derive_deserialize"),
|
token::intern("derive_deserialize"),
|
||||||
ItemDecorator(box expand_derive_deserialize));
|
ItemDecorator(Box::new(expand_derive_deserialize)));
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,9 +89,9 @@ fn expand_derive_serialize<>(cx: &mut ExtCtxt,
|
|||||||
vec!["serde2", "ser", "Visitor"],
|
vec!["serde2", "ser", "Visitor"],
|
||||||
None,
|
None,
|
||||||
vec![
|
vec![
|
||||||
box Literal(Path::new_local("__S")),
|
Box::new(Literal(Path::new_local("__S"))),
|
||||||
box Literal(Path::new_local("__R")),
|
Box::new(Literal(Path::new_local("__R"))),
|
||||||
box Literal(Path::new_local("__E")),
|
Box::new(Literal(Path::new_local("__E"))),
|
||||||
],
|
],
|
||||||
true
|
true
|
||||||
),
|
),
|
||||||
@ -102,7 +102,7 @@ fn expand_derive_serialize<>(cx: &mut ExtCtxt,
|
|||||||
explicit_self: borrowed_explicit_self(),
|
explicit_self: borrowed_explicit_self(),
|
||||||
args: vec![
|
args: vec![
|
||||||
Ptr(
|
Ptr(
|
||||||
box Literal(Path::new_local("__S")),
|
Box::new(Literal(Path::new_local("__S"))),
|
||||||
Borrowed(None, MutMutable)
|
Borrowed(None, MutMutable)
|
||||||
),
|
),
|
||||||
Literal(
|
Literal(
|
||||||
@ -114,16 +114,16 @@ fn expand_derive_serialize<>(cx: &mut ExtCtxt,
|
|||||||
vec!("std", "result", "Result"),
|
vec!("std", "result", "Result"),
|
||||||
None,
|
None,
|
||||||
vec![
|
vec![
|
||||||
box Literal(Path::new_local("__R")),
|
Box::new(Literal(Path::new_local("__R"))),
|
||||||
box Literal(Path::new_local("__E")),
|
Box::new(Literal(Path::new_local("__E"))),
|
||||||
],
|
],
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
attributes: attrs,
|
attributes: attrs,
|
||||||
combine_substructure: combine_substructure(box |a, b, c| {
|
combine_substructure: combine_substructure(Box::new(|a, b, c| {
|
||||||
serialize_substructure(a, b, c)
|
serialize_substructure(a, b, c)
|
||||||
}),
|
})),
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
@ -270,14 +270,14 @@ pub fn expand_derive_deserialize(cx: &mut ExtCtxt,
|
|||||||
span: span,
|
span: span,
|
||||||
attributes: Vec::new(),
|
attributes: Vec::new(),
|
||||||
path: Path::new_(vec!("serde2", "de", "Deserialize"), None,
|
path: Path::new_(vec!("serde2", "de", "Deserialize"), None,
|
||||||
vec!(box Literal(Path::new_local("__D")),
|
vec!(Box::new(Literal(Path::new_local("__D"))),
|
||||||
box Literal(Path::new_local("__E"))), true),
|
Box::new(Literal(Path::new_local("__E")))), true),
|
||||||
additional_bounds: Vec::new(),
|
additional_bounds: Vec::new(),
|
||||||
generics: LifetimeBounds {
|
generics: LifetimeBounds {
|
||||||
lifetimes: Vec::new(),
|
lifetimes: Vec::new(),
|
||||||
bounds: vec!(("__D", None, vec!(Path::new_(
|
bounds: vec!(("__D", None, vec!(Path::new_(
|
||||||
vec!("serde2", "de", "Deserializer"), None,
|
vec!("serde2", "de", "Deserializer"), None,
|
||||||
vec!(box Literal(Path::new_local("__E"))), true))),
|
vec!(Box::new(Literal(Path::new_local("__E")))), true))),
|
||||||
("__E", None, vec!()))
|
("__E", None, vec!()))
|
||||||
},
|
},
|
||||||
methods: vec!(
|
methods: vec!(
|
||||||
@ -287,7 +287,7 @@ pub fn expand_derive_deserialize(cx: &mut ExtCtxt,
|
|||||||
explicit_self: None,
|
explicit_self: None,
|
||||||
args: vec!(
|
args: vec!(
|
||||||
Ptr(
|
Ptr(
|
||||||
box Literal(Path::new_local("__D")),
|
Box::new(Literal(Path::new_local("__D"))),
|
||||||
Borrowed(None, MutMutable)
|
Borrowed(None, MutMutable)
|
||||||
),
|
),
|
||||||
Literal(Path::new(vec!("serde2", "de", "Token"))),
|
Literal(Path::new(vec!("serde2", "de", "Token"))),
|
||||||
@ -297,16 +297,16 @@ pub fn expand_derive_deserialize(cx: &mut ExtCtxt,
|
|||||||
vec!("std", "result", "Result"),
|
vec!("std", "result", "Result"),
|
||||||
None,
|
None,
|
||||||
vec!(
|
vec!(
|
||||||
box Self,
|
Box::new(Self),
|
||||||
box Literal(Path::new_local("__E"))
|
Box::new(Literal(Path::new_local("__E")))
|
||||||
),
|
),
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
attributes: Vec::new(),
|
attributes: Vec::new(),
|
||||||
combine_substructure: combine_substructure(box |a, b, c| {
|
combine_substructure: combine_substructure(Box::new(|a, b, c| {
|
||||||
deserialize_substructure(a, b, c)
|
deserialize_substructure(a, b, c)
|
||||||
}),
|
})),
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -357,7 +357,7 @@ pub fn main() {
|
|||||||
let mut state = MyDeserializer::new(tokens.into_iter());
|
let mut state = MyDeserializer::new(tokens.into_iter());
|
||||||
|
|
||||||
let v: Result<Vec<int>, Error> = Deserialize::deserialize(&mut state);
|
let v: Result<Vec<int>, Error> = Deserialize::deserialize(&mut state);
|
||||||
println!("vec: {}", v);
|
println!("vec: {:?}", v);
|
||||||
|
|
||||||
////
|
////
|
||||||
|
|
||||||
@ -370,7 +370,7 @@ pub fn main() {
|
|||||||
let mut state = MyDeserializer::new(tokens.into_iter());
|
let mut state = MyDeserializer::new(tokens.into_iter());
|
||||||
|
|
||||||
let v: Result<(int, int), Error> = Deserialize::deserialize(&mut state);
|
let v: Result<(int, int), Error> = Deserialize::deserialize(&mut state);
|
||||||
println!("tuple: {}", v);
|
println!("tuple: {:?}", v);
|
||||||
|
|
||||||
////
|
////
|
||||||
|
|
||||||
@ -383,7 +383,7 @@ pub fn main() {
|
|||||||
let mut state = MyDeserializer::new(tokens.into_iter());
|
let mut state = MyDeserializer::new(tokens.into_iter());
|
||||||
|
|
||||||
let v: Result<json::Value, Error> = Deserialize::deserialize(&mut state);
|
let v: Result<json::Value, Error> = Deserialize::deserialize(&mut state);
|
||||||
println!("value: {}", v);
|
println!("value: {:?}", v);
|
||||||
|
|
||||||
////
|
////
|
||||||
|
|
||||||
@ -394,7 +394,7 @@ pub fn main() {
|
|||||||
let mut state = MyDeserializer::new(tokens.into_iter());
|
let mut state = MyDeserializer::new(tokens.into_iter());
|
||||||
|
|
||||||
let v: Result<option::Option<int>, Error> = Deserialize::deserialize(&mut state);
|
let v: Result<option::Option<int>, Error> = Deserialize::deserialize(&mut state);
|
||||||
println!("optiony: {}", v);
|
println!("optiony: {:?}", v);
|
||||||
|
|
||||||
////
|
////
|
||||||
|
|
||||||
@ -404,7 +404,7 @@ pub fn main() {
|
|||||||
let mut state = MyDeserializer::new(tokens.into_iter());
|
let mut state = MyDeserializer::new(tokens.into_iter());
|
||||||
|
|
||||||
let v: Result<option::Option<int>, Error> = Deserialize::deserialize(&mut state);
|
let v: Result<option::Option<int>, Error> = Deserialize::deserialize(&mut state);
|
||||||
println!("optiony: {}", v);
|
println!("optiony: {:?}", v);
|
||||||
|
|
||||||
////
|
////
|
||||||
|
|
||||||
@ -415,7 +415,7 @@ pub fn main() {
|
|||||||
let mut state = MyDeserializer::new(tokens.into_iter());
|
let mut state = MyDeserializer::new(tokens.into_iter());
|
||||||
|
|
||||||
let v: Result<json::Value, Error> = Deserialize::deserialize(&mut state);
|
let v: Result<json::Value, Error> = Deserialize::deserialize(&mut state);
|
||||||
println!("optiony value: {}", v);
|
println!("optiony value: {:?}", v);
|
||||||
|
|
||||||
////
|
////
|
||||||
|
|
||||||
@ -425,7 +425,7 @@ pub fn main() {
|
|||||||
let mut state = MyDeserializer::new(tokens.into_iter());
|
let mut state = MyDeserializer::new(tokens.into_iter());
|
||||||
|
|
||||||
let v: Result<json::Value, Error> = Deserialize::deserialize(&mut state);
|
let v: Result<json::Value, Error> = Deserialize::deserialize(&mut state);
|
||||||
println!("optiony value: {}", v);
|
println!("optiony value: {:?}", v);
|
||||||
|
|
||||||
////
|
////
|
||||||
|
|
||||||
@ -435,7 +435,7 @@ pub fn main() {
|
|||||||
let mut state = MyDeserializer::new(tokens.into_iter());
|
let mut state = MyDeserializer::new(tokens.into_iter());
|
||||||
|
|
||||||
let v: Result<option::Option<int>, Error> = Deserialize::deserialize(&mut state);
|
let v: Result<option::Option<int>, Error> = Deserialize::deserialize(&mut state);
|
||||||
println!("option: {}", v);
|
println!("option: {:?}", v);
|
||||||
|
|
||||||
////
|
////
|
||||||
|
|
||||||
@ -445,7 +445,7 @@ pub fn main() {
|
|||||||
let mut state = MyDeserializer::new(tokens.into_iter());
|
let mut state = MyDeserializer::new(tokens.into_iter());
|
||||||
|
|
||||||
let v: Result<option::Option<int>, Error> = Deserialize::deserialize(&mut state);
|
let v: Result<option::Option<int>, Error> = Deserialize::deserialize(&mut state);
|
||||||
println!("option: {}", v);
|
println!("option: {:?}", v);
|
||||||
|
|
||||||
////
|
////
|
||||||
|
|
||||||
@ -455,7 +455,7 @@ pub fn main() {
|
|||||||
let mut state = MyDeserializer::new(tokens.into_iter());
|
let mut state = MyDeserializer::new(tokens.into_iter());
|
||||||
|
|
||||||
let v: Result<json::Value, Error> = Deserialize::deserialize(&mut state);
|
let v: Result<json::Value, Error> = Deserialize::deserialize(&mut state);
|
||||||
println!("option value: {}", v);
|
println!("option value: {:?}", v);
|
||||||
|
|
||||||
////
|
////
|
||||||
|
|
||||||
@ -465,7 +465,7 @@ pub fn main() {
|
|||||||
let mut state = MyDeserializer::new(tokens.into_iter());
|
let mut state = MyDeserializer::new(tokens.into_iter());
|
||||||
|
|
||||||
let v: Result<json::Value, Error> = Deserialize::deserialize(&mut state);
|
let v: Result<json::Value, Error> = Deserialize::deserialize(&mut state);
|
||||||
println!("option value: {}", v);
|
println!("option value: {:?}", v);
|
||||||
|
|
||||||
////
|
////
|
||||||
|
|
||||||
@ -480,7 +480,7 @@ pub fn main() {
|
|||||||
let mut state = MyDeserializer::new(tokens.into_iter());
|
let mut state = MyDeserializer::new(tokens.into_iter());
|
||||||
|
|
||||||
let v: Result<HashMap<string::String, int>, Error> = Deserialize::deserialize(&mut state);
|
let v: Result<HashMap<string::String, int>, Error> = Deserialize::deserialize(&mut state);
|
||||||
println!("{}", v);
|
println!("{:?}", v);
|
||||||
|
|
||||||
////
|
////
|
||||||
|
|
||||||
@ -495,7 +495,7 @@ pub fn main() {
|
|||||||
let mut state = MyDeserializer::new(tokens.into_iter());
|
let mut state = MyDeserializer::new(tokens.into_iter());
|
||||||
|
|
||||||
let v: Result<json::Value, Error> = Deserialize::deserialize(&mut state);
|
let v: Result<json::Value, Error> = Deserialize::deserialize(&mut state);
|
||||||
println!("{}", v);
|
println!("{:?}", v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -560,9 +560,9 @@ fn main() {
|
|||||||
|
|
||||||
let mut s = GatherTokens::new();
|
let mut s = GatherTokens::new();
|
||||||
value.serialize(&mut s);
|
value.serialize(&mut s);
|
||||||
println!("tokens: {}", s.unwrap());
|
println!("tokens: {:?}", s.unwrap());
|
||||||
|
|
||||||
println!("json: {}", json::to_string(&value).unwrap().unwrap());
|
println!("json: {:?}", json::to_string(&value).unwrap().unwrap());
|
||||||
println!("");
|
println!("");
|
||||||
|
|
||||||
////
|
////
|
||||||
@ -571,9 +571,9 @@ fn main() {
|
|||||||
|
|
||||||
let mut s = GatherTokens::new();
|
let mut s = GatherTokens::new();
|
||||||
value.serialize(&mut s);
|
value.serialize(&mut s);
|
||||||
println!("tokens: {}", s.unwrap());
|
println!("tokens: {:?}", s.unwrap());
|
||||||
|
|
||||||
println!("json: {}", json::to_string(&value).unwrap().unwrap());
|
println!("json: {:?}", json::to_string(&value).unwrap().unwrap());
|
||||||
println!("");
|
println!("");
|
||||||
|
|
||||||
////
|
////
|
||||||
@ -585,25 +585,25 @@ fn main() {
|
|||||||
|
|
||||||
let mut s = GatherTokens::new();
|
let mut s = GatherTokens::new();
|
||||||
value.serialize(&mut s);
|
value.serialize(&mut s);
|
||||||
println!("tokens: {}", s.unwrap());
|
println!("tokens: {:?}", s.unwrap());
|
||||||
|
|
||||||
println!("json: {}", json::to_string(&value).unwrap().unwrap());
|
println!("json: {:?}", json::to_string(&value).unwrap().unwrap());
|
||||||
println!("");
|
println!("");
|
||||||
|
|
||||||
////
|
////
|
||||||
|
|
||||||
/*
|
/*
|
||||||
println!("{}", to_format_vec(&5i));
|
println!("{:?}", to_format_vec(&5i));
|
||||||
println!("{}", to_format_string(&5i));
|
println!("{:?}", to_format_string(&5i));
|
||||||
*/
|
*/
|
||||||
|
|
||||||
let value = Foo { x: 1, y: 2, z: "abc" };
|
let value = Foo { x: 1, y: 2, z: "abc" };
|
||||||
|
|
||||||
let mut s = GatherTokens::new();
|
let mut s = GatherTokens::new();
|
||||||
value.serialize(&mut s);
|
value.serialize(&mut s);
|
||||||
println!("tokens: {}", s.unwrap());
|
println!("tokens: {:?}", s.unwrap());
|
||||||
|
|
||||||
println!("json: {}", json::to_string(&value).unwrap().unwrap());
|
println!("json: {:?}", json::to_string(&value).unwrap().unwrap());
|
||||||
println!("");
|
println!("");
|
||||||
|
|
||||||
////
|
////
|
||||||
@ -612,9 +612,9 @@ fn main() {
|
|||||||
|
|
||||||
let mut s = GatherTokens::new();
|
let mut s = GatherTokens::new();
|
||||||
value.serialize(&mut s);
|
value.serialize(&mut s);
|
||||||
println!("tokens: {}", s.unwrap());
|
println!("tokens: {:?}", s.unwrap());
|
||||||
|
|
||||||
println!("json: {}", json::to_string(&value).unwrap().unwrap());
|
println!("json: {:?}", json::to_string(&value).unwrap().unwrap());
|
||||||
println!("");
|
println!("");
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
use std::collections::{HashMap, BTreeMap};
|
use std::collections::{HashMap, BTreeMap};
|
||||||
|
use std::collections::hash_map::Hasher;
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
use std::num::FromPrimitive;
|
use std::num::FromPrimitive;
|
||||||
|
|
||||||
@ -429,7 +430,7 @@ impl_deserialize_tuple! { T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, }
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
impl<
|
impl<
|
||||||
K: Deserialize<S, E> + Eq + Hash,
|
K: Deserialize<S, E> + Eq + Hash<Hasher>,
|
||||||
V: Deserialize<S, E>,
|
V: Deserialize<S, E>,
|
||||||
S: Deserializer<E>,
|
S: Deserializer<E>,
|
||||||
E: Error,
|
E: Error,
|
||||||
@ -438,7 +439,7 @@ impl<
|
|||||||
struct Visitor;
|
struct Visitor;
|
||||||
|
|
||||||
impl<
|
impl<
|
||||||
K: Deserialize<S, E> + Eq + Hash,
|
K: Deserialize<S, E> + Eq + Hash<Hasher>,
|
||||||
V: Deserialize<S, E>,
|
V: Deserialize<S, E>,
|
||||||
S: Deserializer<E>,
|
S: Deserializer<E>,
|
||||||
E: Error,
|
E: Error,
|
||||||
|
@ -103,7 +103,7 @@ impl error::Error for Error {
|
|||||||
fn detail(&self) -> Option<String> {
|
fn detail(&self) -> Option<String> {
|
||||||
match *self {
|
match *self {
|
||||||
Error::SyntaxError(ref code, line, col) => {
|
Error::SyntaxError(ref code, line, col) => {
|
||||||
Some(format!("{} at line {} column {}", code, line, col))
|
Some(format!("{:?} at line {:?} column {:?}", code, line, col))
|
||||||
}
|
}
|
||||||
Error::IoError(ref error) => error.detail(),
|
Error::IoError(ref error) => error.detail(),
|
||||||
/*
|
/*
|
||||||
|
@ -473,8 +473,8 @@ impl<
|
|||||||
> MapVisitor<S, R, E> for MapIteratorVisitor<Iter> {
|
> MapVisitor<S, R, E> for MapIteratorVisitor<Iter> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn visit<
|
fn visit<
|
||||||
V: Visitor<S, R, E>,
|
VS: Visitor<S, R, E>,
|
||||||
>(&mut self, state: &mut S, visitor: V) -> Result<Option<R>, E> {
|
>(&mut self, state: &mut S, visitor: VS) -> Result<Option<R>, E> {
|
||||||
let first = self.first;
|
let first = self.first;
|
||||||
self.first = false;
|
self.first = false;
|
||||||
|
|
||||||
@ -504,8 +504,8 @@ impl<
|
|||||||
S,
|
S,
|
||||||
R,
|
R,
|
||||||
E,
|
E,
|
||||||
V: Visitor<S, R, E>,
|
VS: Visitor<S, R, E>,
|
||||||
>(&self, state: &mut S, visitor: V) -> Result<R, E> {
|
>(&self, state: &mut S, visitor: VS) -> Result<R, E> {
|
||||||
visitor.visit_map(state, MapIteratorVisitor::new(self.iter()))
|
visitor.visit_map(state, MapIteratorVisitor::new(self.iter()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,11 +59,11 @@ use rustc::plugin::Registry;
|
|||||||
pub fn plugin_registrar(reg: &mut Registry) {
|
pub fn plugin_registrar(reg: &mut Registry) {
|
||||||
reg.register_syntax_extension(
|
reg.register_syntax_extension(
|
||||||
token::intern("derive_serialize"),
|
token::intern("derive_serialize"),
|
||||||
Decorator(box expand_derive_serialize));
|
Decorator(Box::new(expand_derive_serialize)));
|
||||||
|
|
||||||
reg.register_syntax_extension(
|
reg.register_syntax_extension(
|
||||||
token::intern("derive_deserialize"),
|
token::intern("derive_deserialize"),
|
||||||
Decorator(box expand_derive_deserialize));
|
Decorator(Box::new(expand_derive_deserialize)));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn expand_derive_serialize(cx: &mut ExtCtxt,
|
fn expand_derive_serialize(cx: &mut ExtCtxt,
|
||||||
@ -78,14 +78,14 @@ fn expand_derive_serialize(cx: &mut ExtCtxt,
|
|||||||
span: sp,
|
span: sp,
|
||||||
attributes: vec!(),
|
attributes: vec!(),
|
||||||
path: Path::new_(vec!("serde", "ser", "Serialize"), None,
|
path: Path::new_(vec!("serde", "ser", "Serialize"), None,
|
||||||
vec!(box Literal(Path::new_local("__S")),
|
vec!(Box::new(Literal(Path::new_local("__S"))),
|
||||||
box Literal(Path::new_local("__E"))), true),
|
Box::new(Literal(Path::new_local("__E")))), true),
|
||||||
additional_bounds: Vec::new(),
|
additional_bounds: Vec::new(),
|
||||||
generics: LifetimeBounds {
|
generics: LifetimeBounds {
|
||||||
lifetimes: Vec::new(),
|
lifetimes: Vec::new(),
|
||||||
bounds: vec!(("__S", vec!(Path::new_(
|
bounds: vec!(("__S", vec!(Path::new_(
|
||||||
vec!("serde", "ser", "Serializer"), None,
|
vec!("serde", "ser", "Serializer"), None,
|
||||||
vec!(box Literal(Path::new_local("__E"))), true))),
|
vec!(Box::new(Literal(Path::new_local("__E")))), true))),
|
||||||
("__E", vec!()))
|
("__E", vec!()))
|
||||||
},
|
},
|
||||||
methods: vec!(
|
methods: vec!(
|
||||||
@ -93,23 +93,23 @@ fn expand_derive_serialize(cx: &mut ExtCtxt,
|
|||||||
name: "serialize",
|
name: "serialize",
|
||||||
generics: LifetimeBounds::empty(),
|
generics: LifetimeBounds::empty(),
|
||||||
explicit_self: borrowed_explicit_self(),
|
explicit_self: borrowed_explicit_self(),
|
||||||
args: vec!(Ptr(box Literal(Path::new_local("__S")),
|
args: vec!(Ptr(Box::new(Literal(Path::new_local("__S"))),
|
||||||
Borrowed(None, MutMutable))),
|
Borrowed(None, MutMutable))),
|
||||||
ret_ty: Literal(
|
ret_ty: Literal(
|
||||||
Path::new_(
|
Path::new_(
|
||||||
vec!("std", "result", "Result"),
|
vec!("std", "result", "Result"),
|
||||||
None,
|
None,
|
||||||
vec!(
|
vec!(
|
||||||
box Tuple(Vec::new()),
|
Box::new(Tuple(Vec::new())),
|
||||||
box Literal(Path::new_local("__E"))
|
Box::new(Literal(Path::new_local("__E")))
|
||||||
),
|
),
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
attributes: attrs,
|
attributes: attrs,
|
||||||
combine_substructure: combine_substructure(box |a, b, c| {
|
combine_substructure: combine_substructure(Box::new( |a, b, c| {
|
||||||
serialize_substructure(a, b, c, item)
|
serialize_substructure(a, b, c, item)
|
||||||
}),
|
})),
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -204,14 +204,14 @@ pub fn expand_derive_deserialize(cx: &mut ExtCtxt,
|
|||||||
span: span,
|
span: span,
|
||||||
attributes: Vec::new(),
|
attributes: Vec::new(),
|
||||||
path: Path::new_(vec!("serde", "de", "Deserialize"), None,
|
path: Path::new_(vec!("serde", "de", "Deserialize"), None,
|
||||||
vec!(box Literal(Path::new_local("__D")),
|
vec!(Box::new(Literal(Path::new_local("__D"))),
|
||||||
box Literal(Path::new_local("__E"))), true),
|
Box::new(Literal(Path::new_local("__E")))), true),
|
||||||
additional_bounds: Vec::new(),
|
additional_bounds: Vec::new(),
|
||||||
generics: LifetimeBounds {
|
generics: LifetimeBounds {
|
||||||
lifetimes: Vec::new(),
|
lifetimes: Vec::new(),
|
||||||
bounds: vec!(("__D", vec!(Path::new_(
|
bounds: vec!(("__D", vec!(Path::new_(
|
||||||
vec!("serde", "de", "Deserializer"), None,
|
vec!("serde", "de", "Deserializer"), None,
|
||||||
vec!(box Literal(Path::new_local("__E"))), true))),
|
vec!(Box::new(Literal(Path::new_local("__E")))), true))),
|
||||||
("__E", vec!()))
|
("__E", vec!()))
|
||||||
},
|
},
|
||||||
methods: vec!(
|
methods: vec!(
|
||||||
@ -221,7 +221,7 @@ pub fn expand_derive_deserialize(cx: &mut ExtCtxt,
|
|||||||
explicit_self: None,
|
explicit_self: None,
|
||||||
args: vec!(
|
args: vec!(
|
||||||
Ptr(
|
Ptr(
|
||||||
box Literal(Path::new_local("__D")),
|
Box::new(Literal(Path::new_local("__D"))),
|
||||||
Borrowed(None, MutMutable)
|
Borrowed(None, MutMutable)
|
||||||
),
|
),
|
||||||
Literal(Path::new(vec!("serde", "de", "Token"))),
|
Literal(Path::new(vec!("serde", "de", "Token"))),
|
||||||
@ -231,16 +231,16 @@ pub fn expand_derive_deserialize(cx: &mut ExtCtxt,
|
|||||||
vec!("std", "result", "Result"),
|
vec!("std", "result", "Result"),
|
||||||
None,
|
None,
|
||||||
vec!(
|
vec!(
|
||||||
box Self,
|
Box::new(Self),
|
||||||
box Literal(Path::new_local("__E"))
|
Box::new(Literal(Path::new_local("__E")))
|
||||||
),
|
),
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
attributes: Vec::new(),
|
attributes: Vec::new(),
|
||||||
combine_substructure: combine_substructure(box |a, b, c| {
|
combine_substructure: combine_substructure(Box::new(|a, b, c| {
|
||||||
deserialize_substructure(a, b, c)
|
deserialize_substructure(a, b, c)
|
||||||
}),
|
})),
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
73
src/de.rs
73
src/de.rs
@ -9,6 +9,7 @@
|
|||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
use std::collections::{HashMap, HashSet, BTreeMap, BTreeSet};
|
use std::collections::{HashMap, HashSet, BTreeMap, BTreeSet};
|
||||||
|
use std::collections::hash_map::Hasher;
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
use std::iter::FromIterator;
|
use std::iter::FromIterator;
|
||||||
use std::num::{self, FromPrimitive};
|
use std::num::{self, FromPrimitive};
|
||||||
@ -706,7 +707,7 @@ impl<
|
|||||||
> Deserialize<D, E> for Box<T> {
|
> Deserialize<D, E> for Box<T> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn deserialize_token(d: &mut D, token: Token) -> Result<Box<T>, E> {
|
fn deserialize_token(d: &mut D, token: Token) -> Result<Box<T>, E> {
|
||||||
Ok(box try!(Deserialize::deserialize_token(d, token)))
|
Ok(Box::new(try!(Deserialize::deserialize_token(d, token))))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -763,7 +764,7 @@ impl<
|
|||||||
impl<
|
impl<
|
||||||
D: Deserializer<E>,
|
D: Deserializer<E>,
|
||||||
E,
|
E,
|
||||||
K: Deserialize<D, E> + Eq + Hash,
|
K: Deserialize<D, E> + Eq + Hash<Hasher>,
|
||||||
V: Deserialize<D, E>
|
V: Deserialize<D, E>
|
||||||
> Deserialize<D, E> for HashMap<K, V> {
|
> Deserialize<D, E> for HashMap<K, V> {
|
||||||
#[inline]
|
#[inline]
|
||||||
@ -789,7 +790,7 @@ impl<
|
|||||||
impl<
|
impl<
|
||||||
D: Deserializer<E>,
|
D: Deserializer<E>,
|
||||||
E,
|
E,
|
||||||
T: Deserialize<D, E> + Eq + Hash
|
T: Deserialize<D, E> + Eq + Hash<Hasher>
|
||||||
> Deserialize<D, E> for HashSet<T> {
|
> Deserialize<D, E> for HashSet<T> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn deserialize_token(d: &mut D, token: Token) -> Result<HashSet<T>, E> {
|
fn deserialize_token(d: &mut D, token: Token) -> Result<HashSet<T>, E> {
|
||||||
@ -1253,7 +1254,7 @@ mod tests {
|
|||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
macro_rules! test_value {
|
macro_rules! test_value {
|
||||||
($name:ident, [$($tokens:expr => $value:expr: $ty:ty),*]) => {
|
($name:ident, [$($tokens:expr => $value:expr, $ty:ty),*]) => {
|
||||||
#[test]
|
#[test]
|
||||||
fn $name() {
|
fn $name() {
|
||||||
$(
|
$(
|
||||||
@ -1267,31 +1268,31 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
test_value!(test_primitives, [
|
test_value!(test_primitives, [
|
||||||
vec!(Token::Null) => (): (),
|
vec!(Token::Null) => (), (),
|
||||||
vec!(Token::Bool(true)) => true: bool,
|
vec!(Token::Bool(true)) => true, bool,
|
||||||
vec!(Token::Bool(false)) => false: bool,
|
vec!(Token::Bool(false)) => false, bool,
|
||||||
vec!(Token::Int(5)) => 5: int,
|
vec!(Token::Int(5)) => 5, int,
|
||||||
vec!(Token::I8(5)) => 5: i8,
|
vec!(Token::I8(5)) => 5, i8,
|
||||||
vec!(Token::I16(5)) => 5: i16,
|
vec!(Token::I16(5)) => 5, i16,
|
||||||
vec!(Token::I32(5)) => 5: i32,
|
vec!(Token::I32(5)) => 5, i32,
|
||||||
vec!(Token::I64(5)) => 5: i64,
|
vec!(Token::I64(5)) => 5, i64,
|
||||||
vec!(Token::Uint(5)) => 5: uint,
|
vec!(Token::Uint(5)) => 5, uint,
|
||||||
vec!(Token::U8(5)) => 5: u8,
|
vec!(Token::U8(5)) => 5, u8,
|
||||||
vec!(Token::U16(5)) => 5: u16,
|
vec!(Token::U16(5)) => 5, u16,
|
||||||
vec!(Token::U32(5)) => 5: u32,
|
vec!(Token::U32(5)) => 5, u32,
|
||||||
vec!(Token::U64(5)) => 5: u64,
|
vec!(Token::U64(5)) => 5, u64,
|
||||||
vec!(Token::F32(5.0)) => 5.0: f32,
|
vec!(Token::F32(5.0)) => 5.0, f32,
|
||||||
vec!(Token::F64(5.0)) => 5.0: f64,
|
vec!(Token::F64(5.0)) => 5.0, f64,
|
||||||
vec!(Token::Char('c')) => 'c': char,
|
vec!(Token::Char('c')) => 'c', char,
|
||||||
vec!(Token::Str("abc")) => "abc": &str,
|
vec!(Token::Str("abc")) => "abc", &str,
|
||||||
vec!(Token::String("abc".to_string())) => "abc".to_string(): string::String
|
vec!(Token::String("abc".to_string())) => "abc".to_string(), string::String
|
||||||
]);
|
]);
|
||||||
|
|
||||||
test_value!(test_tuples, [
|
test_value!(test_tuples, [
|
||||||
vec!(
|
vec!(
|
||||||
Token::TupleStart(0),
|
Token::TupleStart(0),
|
||||||
Token::End,
|
Token::End,
|
||||||
) => (): (),
|
) => (), (),
|
||||||
|
|
||||||
vec!(
|
vec!(
|
||||||
Token::TupleStart(2),
|
Token::TupleStart(2),
|
||||||
@ -1299,7 +1300,7 @@ mod tests {
|
|||||||
|
|
||||||
Token::Str("a"),
|
Token::Str("a"),
|
||||||
Token::End,
|
Token::End,
|
||||||
) => (5, "a"): (int, &'static str),
|
) => (5, "a"), (int, &'static str),
|
||||||
|
|
||||||
vec!(
|
vec!(
|
||||||
Token::TupleStart(3),
|
Token::TupleStart(3),
|
||||||
@ -1314,16 +1315,16 @@ mod tests {
|
|||||||
Token::Str("a"),
|
Token::Str("a"),
|
||||||
Token::End,
|
Token::End,
|
||||||
Token::End,
|
Token::End,
|
||||||
) => ((), (), (5, "a")): ((), (), (int, &'static str))
|
) => ((), (), (5, "a")), ((), (), (int, &'static str))
|
||||||
]);
|
]);
|
||||||
|
|
||||||
test_value!(test_options, [
|
test_value!(test_options, [
|
||||||
vec!(Token::Option(false)) => None: option::Option<int>,
|
vec!(Token::Option(false)) => None, option::Option<int>,
|
||||||
|
|
||||||
vec!(
|
vec!(
|
||||||
Token::Option(true),
|
Token::Option(true),
|
||||||
Token::Int(5),
|
Token::Int(5),
|
||||||
) => Some(5): option::Option<int>
|
) => Some(5), option::Option<int>
|
||||||
]);
|
]);
|
||||||
|
|
||||||
test_value!(test_structs, [
|
test_value!(test_structs, [
|
||||||
@ -1333,7 +1334,7 @@ mod tests {
|
|||||||
Token::SeqStart(0),
|
Token::SeqStart(0),
|
||||||
Token::End,
|
Token::End,
|
||||||
Token::End,
|
Token::End,
|
||||||
) => Outer { inner: vec!() }: Outer,
|
) => Outer { inner: vec!() }, Outer,
|
||||||
|
|
||||||
vec!(
|
vec!(
|
||||||
Token::StructStart("Outer", 1),
|
Token::StructStart("Outer", 1),
|
||||||
@ -1364,28 +1365,28 @@ mod tests {
|
|||||||
c: treemap!("abc".to_string() => Some('c')),
|
c: treemap!("abc".to_string() => Some('c')),
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
}: Outer
|
}, Outer
|
||||||
]);
|
]);
|
||||||
|
|
||||||
test_value!(test_enums, [
|
test_value!(test_enums, [
|
||||||
vec!(
|
vec!(
|
||||||
Token::EnumStart("Animal", "Dog", 0),
|
Token::EnumStart("Animal", "Dog", 0),
|
||||||
Token::End,
|
Token::End,
|
||||||
) => Animal::Dog: Animal,
|
) => Animal::Dog, Animal,
|
||||||
|
|
||||||
vec!(
|
vec!(
|
||||||
Token::EnumStart("Animal", "Frog", 2),
|
Token::EnumStart("Animal", "Frog", 2),
|
||||||
Token::String("Henry".to_string()),
|
Token::String("Henry".to_string()),
|
||||||
Token::Int(349),
|
Token::Int(349),
|
||||||
Token::End,
|
Token::End,
|
||||||
) => Animal::Frog("Henry".to_string(), 349): Animal
|
) => Animal::Frog("Henry".to_string(), 349), Animal
|
||||||
]);
|
]);
|
||||||
|
|
||||||
test_value!(test_vecs, [
|
test_value!(test_vecs, [
|
||||||
vec!(
|
vec!(
|
||||||
Token::SeqStart(0),
|
Token::SeqStart(0),
|
||||||
Token::End,
|
Token::End,
|
||||||
) => vec!(): Vec<int>,
|
) => vec!(), Vec<int>,
|
||||||
|
|
||||||
vec!(
|
vec!(
|
||||||
Token::SeqStart(3),
|
Token::SeqStart(3),
|
||||||
@ -1395,7 +1396,7 @@ mod tests {
|
|||||||
|
|
||||||
Token::Int(7),
|
Token::Int(7),
|
||||||
Token::End,
|
Token::End,
|
||||||
) => vec!(5, 6, 7): Vec<int>,
|
) => vec!(5, 6, 7), Vec<int>,
|
||||||
|
|
||||||
|
|
||||||
vec!(
|
vec!(
|
||||||
@ -1418,14 +1419,14 @@ mod tests {
|
|||||||
Token::Int(6),
|
Token::Int(6),
|
||||||
Token::End,
|
Token::End,
|
||||||
Token::End,
|
Token::End,
|
||||||
) => vec!(vec!(1), vec!(2, 3), vec!(4, 5, 6)): Vec<Vec<int>>
|
) => vec!(vec!(1), vec!(2, 3), vec!(4, 5, 6)), Vec<Vec<int>>
|
||||||
]);
|
]);
|
||||||
|
|
||||||
test_value!(test_treemaps, [
|
test_value!(test_treemaps, [
|
||||||
vec!(
|
vec!(
|
||||||
Token::MapStart(0),
|
Token::MapStart(0),
|
||||||
Token::End,
|
Token::End,
|
||||||
) => treemap!(): BTreeMap<int, string::String>,
|
) => treemap!(), BTreeMap<int, string::String>,
|
||||||
|
|
||||||
vec!(
|
vec!(
|
||||||
Token::MapStart(2),
|
Token::MapStart(2),
|
||||||
@ -1435,7 +1436,7 @@ mod tests {
|
|||||||
Token::Int(6),
|
Token::Int(6),
|
||||||
Token::String("b".to_string()),
|
Token::String("b".to_string()),
|
||||||
Token::End,
|
Token::End,
|
||||||
) => treemap!(5i => "a".to_string(), 6i => "b".to_string()): BTreeMap<int, string::
|
) => treemap!(5i => "a".to_string(), 6i => "b".to_string()), BTreeMap<int, string::
|
||||||
String>
|
String>
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ pub enum ErrorCode {
|
|||||||
impl fmt::Show for ErrorCode {
|
impl fmt::Show for ErrorCode {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
match *self {
|
match *self {
|
||||||
ErrorCode::ConversionError(ref token) => write!(f, "failed to convert {}", token),
|
ErrorCode::ConversionError(ref token) => write!(f, "failed to convert {:?}", token),
|
||||||
ErrorCode::EOFWhileParsingList => "EOF While parsing list".fmt(f),
|
ErrorCode::EOFWhileParsingList => "EOF While parsing list".fmt(f),
|
||||||
ErrorCode::EOFWhileParsingObject => "EOF While parsing object".fmt(f),
|
ErrorCode::EOFWhileParsingObject => "EOF While parsing object".fmt(f),
|
||||||
ErrorCode::EOFWhileParsingString => "EOF While parsing string".fmt(f),
|
ErrorCode::EOFWhileParsingString => "EOF While parsing string".fmt(f),
|
||||||
@ -60,7 +60,7 @@ impl fmt::Show for ErrorCode {
|
|||||||
ErrorCode::ExpectedObjectCommaOrEnd => "expected `,` or `}`".fmt(f),
|
ErrorCode::ExpectedObjectCommaOrEnd => "expected `,` or `}`".fmt(f),
|
||||||
ErrorCode::ExpectedSomeIdent => "expected ident".fmt(f),
|
ErrorCode::ExpectedSomeIdent => "expected ident".fmt(f),
|
||||||
ErrorCode::ExpectedSomeValue => "expected value".fmt(f),
|
ErrorCode::ExpectedSomeValue => "expected value".fmt(f),
|
||||||
ErrorCode::ExpectedTokens(ref token, tokens) => write!(f, "expected {}, found {}", tokens, token),
|
ErrorCode::ExpectedTokens(ref token, tokens) => write!(f, "expected {:?}, found {:?}", tokens, token),
|
||||||
ErrorCode::InvalidEscape => "invalid escape".fmt(f),
|
ErrorCode::InvalidEscape => "invalid escape".fmt(f),
|
||||||
ErrorCode::InvalidNumber => "invalid number".fmt(f),
|
ErrorCode::InvalidNumber => "invalid number".fmt(f),
|
||||||
ErrorCode::InvalidUnicodeCodePoint => "invalid unicode code point".fmt(f),
|
ErrorCode::InvalidUnicodeCodePoint => "invalid unicode code point".fmt(f),
|
||||||
@ -71,7 +71,7 @@ impl fmt::Show for ErrorCode {
|
|||||||
ErrorCode::NotUtf8 => "contents not utf-8".fmt(f),
|
ErrorCode::NotUtf8 => "contents not utf-8".fmt(f),
|
||||||
ErrorCode::TrailingCharacters => "trailing characters".fmt(f),
|
ErrorCode::TrailingCharacters => "trailing characters".fmt(f),
|
||||||
ErrorCode::UnexpectedEndOfHexEscape => "unexpected end of hex escape".fmt(f),
|
ErrorCode::UnexpectedEndOfHexEscape => "unexpected end of hex escape".fmt(f),
|
||||||
ErrorCode::UnexpectedName(ref name) => write!(f, "unexpected name {}", name),
|
ErrorCode::UnexpectedName(ref name) => write!(f, "unexpected name {:?}", name),
|
||||||
ErrorCode::UnknownVariant => "unknown variant".fmt(f),
|
ErrorCode::UnknownVariant => "unknown variant".fmt(f),
|
||||||
ErrorCode::UnrecognizedHex => "invalid \\u escape (unrecognized hex)".fmt(f),
|
ErrorCode::UnrecognizedHex => "invalid \\u escape (unrecognized hex)".fmt(f),
|
||||||
}
|
}
|
||||||
@ -102,17 +102,17 @@ impl error::Error for Error {
|
|||||||
fn detail(&self) -> Option<String> {
|
fn detail(&self) -> Option<String> {
|
||||||
match *self {
|
match *self {
|
||||||
Error::SyntaxError(ref code, line, col) => {
|
Error::SyntaxError(ref code, line, col) => {
|
||||||
Some(format!("{} at line {} column {}", code, line, col))
|
Some(format!("{:?} at line {:?} column {:?}", code, line, col))
|
||||||
}
|
}
|
||||||
Error::IoError(ref error) => error.detail(),
|
Error::IoError(ref error) => error.detail(),
|
||||||
Error::ExpectedError(ref expected, ref found) => {
|
Error::ExpectedError(ref expected, ref found) => {
|
||||||
Some(format!("expected {}, found {}", expected, found))
|
Some(format!("expected {:?}, found {:?}", expected, found))
|
||||||
}
|
}
|
||||||
Error::MissingFieldError(ref field) => {
|
Error::MissingFieldError(ref field) => {
|
||||||
Some(format!("missing field {}", field))
|
Some(format!("missing field {:?}", field))
|
||||||
}
|
}
|
||||||
Error::UnknownVariantError(ref variant) => {
|
Error::UnknownVariantError(ref variant) => {
|
||||||
Some(format!("unknown variant {}", variant))
|
Some(format!("unknown variant {:?}", variant))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ fn main() {
|
|||||||
let mut serializer = json::Serializer::new(wr.by_ref());
|
let mut serializer = json::Serializer::new(wr.by_ref());
|
||||||
match to_serialize_object.serialize(&mut serializer) {
|
match to_serialize_object.serialize(&mut serializer) {
|
||||||
Ok(()) => (),
|
Ok(()) => (),
|
||||||
Err(e) => panic!("json serialization error: {}", e),
|
Err(e) => panic!("json serialization error: {:?}", e),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -192,7 +192,7 @@ fn main() {
|
|||||||
let mut parser = json::Parser::new(json_str_to_deserialize.bytes());
|
let mut parser = json::Parser::new(json_str_to_deserialize.bytes());
|
||||||
let deserialized_object: MyStruct = match Deserialize::deserialize(&mut parser) {
|
let deserialized_object: MyStruct = match Deserialize::deserialize(&mut parser) {
|
||||||
Ok(v) => v,
|
Ok(v) => v,
|
||||||
Err(e) => panic!("Decoding error: {}", e)
|
Err(e) => panic!("Decoding error: {:?}", e)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@ -234,7 +234,7 @@ fn main() {
|
|||||||
|
|
||||||
let deserialized_object: TestStruct1 = match json::from_str(serialized_str.as_slice()) {
|
let deserialized_object: TestStruct1 = match json::from_str(serialized_str.as_slice()) {
|
||||||
Ok(deserialized_object) => deserialized_object,
|
Ok(deserialized_object) => deserialized_object,
|
||||||
Err(e) => panic!("json deserialization error: {}", e),
|
Err(e) => panic!("json deserialization error: {:?}", e),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@ -1918,7 +1918,7 @@ mod bench {
|
|||||||
match parser.next() {
|
match parser.next() {
|
||||||
None => return,
|
None => return,
|
||||||
Some(Ok(_)) => { }
|
Some(Ok(_)) => { }
|
||||||
Some(Err(err)) => { panic!("error: {}", err); }
|
Some(Err(err)) => { panic!("error: {:?}", err); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -3,6 +3,7 @@ use std::fmt;
|
|||||||
use std::io::{ByRefWriter, IoResult};
|
use std::io::{ByRefWriter, IoResult};
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::str;
|
use std::str;
|
||||||
|
use std::string::ToString;
|
||||||
use std::vec;
|
use std::vec;
|
||||||
|
|
||||||
use de::{self, Token, TokenKind};
|
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> {
|
struct WriterFormatter<'a, 'b: 'a> {
|
||||||
inner: &'a mut fmt::Formatter<'b>,
|
inner: &'a mut fmt::Formatter<'b>,
|
||||||
}
|
}
|
||||||
@ -449,7 +458,7 @@ impl de::Deserializer<Error> for Deserializer {
|
|||||||
return Err(
|
return Err(
|
||||||
Error::ExpectedError(
|
Error::ExpectedError(
|
||||||
"Array".to_string(),
|
"Array".to_string(),
|
||||||
format!("{} => {}", key, value)
|
format!("{:?} => {:?}", key, value)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -464,7 +473,7 @@ impl de::Deserializer<Error> for Deserializer {
|
|||||||
return Err(
|
return Err(
|
||||||
Error::ExpectedError(
|
Error::ExpectedError(
|
||||||
"None".to_string(),
|
"None".to_string(),
|
||||||
format!("{} => {}", key, value)
|
format!("{:?} => {:?}", key, value)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -483,7 +492,7 @@ impl de::Deserializer<Error> for Deserializer {
|
|||||||
return Err(
|
return Err(
|
||||||
Error::ExpectedError(
|
Error::ExpectedError(
|
||||||
"String or Object".to_string(),
|
"String or Object".to_string(),
|
||||||
format!("{}", token)
|
format!("{:?}", token)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#![feature(plugin)]
|
#![feature(plugin)]
|
||||||
|
#![allow(unstable)]
|
||||||
#![crate_type = "dylib"]
|
#![crate_type = "dylib"]
|
||||||
#![crate_type = "rlib"]
|
#![crate_type = "rlib"]
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
use std::collections::{HashMap, HashSet, BTreeMap, BTreeSet};
|
use std::collections::{HashMap, HashSet, BTreeMap, BTreeSet};
|
||||||
|
use std::collections::hash_map::Hasher;
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
@ -225,7 +226,7 @@ impl<
|
|||||||
impl<
|
impl<
|
||||||
S: Serializer<E>,
|
S: Serializer<E>,
|
||||||
E,
|
E,
|
||||||
K: Serialize<S, E> + Eq + Hash,
|
K: Serialize<S, E> + Eq + Hash<Hasher>,
|
||||||
V: Serialize<S, E>
|
V: Serialize<S, E>
|
||||||
> Serialize<S, E> for HashMap<K, V> {
|
> Serialize<S, E> for HashMap<K, V> {
|
||||||
#[inline]
|
#[inline]
|
||||||
@ -251,7 +252,7 @@ impl<
|
|||||||
impl<
|
impl<
|
||||||
S: Serializer<E>,
|
S: Serializer<E>,
|
||||||
E,
|
E,
|
||||||
T: Serialize<S, E> + Eq + Hash
|
T: Serialize<S, E> + Eq + Hash<Hasher>
|
||||||
> Serialize<S, E> for HashSet<T> {
|
> Serialize<S, E> for HashSet<T> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn serialize(&self, s: &mut S) -> Result<(), E> {
|
fn serialize(&self, s: &mut S) -> Result<(), E> {
|
||||||
|
Loading…
Reference in New Issue
Block a user