udpated serde to version 0.7.0

This commit is contained in:
debris
2016-02-27 13:14:58 +01:00
parent db9774fb62
commit 11de5b4923
10 changed files with 48 additions and 42 deletions

View File

@@ -239,7 +239,7 @@ macro_rules! impl_hash {
where S: serde::Serializer {
let mut hex = "0x".to_owned();
hex.push_str(self.to_hex().as_ref());
serializer.visit_str(hex.as_ref())
serializer.serialize_str(hex.as_ref())
}
}
@@ -254,10 +254,10 @@ macro_rules! impl_hash {
fn visit_str<E>(&mut self, value: &str) -> Result<Self::Value, E> where E: serde::Error {
// 0x + len
if value.len() != 2 + $size * 2 {
return Err(serde::Error::syntax("Invalid length."));
return Err(serde::Error::custom("Invalid length."));
}
value[2..].from_hex().map(|ref v| $from::from_slice(v)).map_err(|_| serde::Error::syntax("Invalid valid hex."))
value[2..].from_hex().map(|ref v| $from::from_slice(v)).map_err(|_| serde::Error::custom("Invalid valid hex."))
}
fn visit_string<E>(&mut self, value: String) -> Result<Self::Value, E> where E: serde::Error {
@@ -265,7 +265,7 @@ macro_rules! impl_hash {
}
}
deserializer.visit(HashVisitor)
deserializer.deserialize(HashVisitor)
}
}

View File

@@ -760,7 +760,7 @@ macro_rules! construct_uint {
self.to_bytes(&mut bytes);
let len = cmp::max((self.bits() + 7) / 8, 1);
hex.push_str(bytes[bytes.len() - len..].to_hex().as_ref());
serializer.visit_str(hex.as_ref())
serializer.serialize_str(hex.as_ref())
}
}