commit
daf7a08ad3
|
@ -18,7 +18,7 @@ name = "chrono"
|
|||
time = "0.1"
|
||||
num = { version = "0.1", default-features = false }
|
||||
rustc-serialize = { version = "0.3", optional = true }
|
||||
serde = { version = "^0.6.0", optional = true }
|
||||
serde = { version = "^0.7.0", optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
serde_json = { version = "^0.6.0" }
|
||||
serde_json = { version = "^0.7.0" }
|
||||
|
|
|
@ -383,7 +383,7 @@ mod serde {
|
|||
where S: ser::Serializer
|
||||
{
|
||||
// Debug formatting is correct RFC3339, and it allows Zulu.
|
||||
serializer.visit_str(&format!("{:?}", self))
|
||||
serializer.serialize_str(&format!("{:?}", self))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -395,7 +395,7 @@ mod serde {
|
|||
fn visit_str<E>(&mut self, value: &str) -> Result<DateTime<FixedOffset>, E>
|
||||
where E: de::Error
|
||||
{
|
||||
value.parse().map_err(|err| E::syntax(&format!("{}", err)))
|
||||
value.parse().map_err(|err| E::custom(format!("{}", err)))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -403,7 +403,7 @@ mod serde {
|
|||
fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error>
|
||||
where D: de::Deserializer
|
||||
{
|
||||
deserializer.visit(DateTimeVisitor)
|
||||
deserializer.deserialize(DateTimeVisitor)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -411,7 +411,7 @@ mod serde {
|
|||
fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error>
|
||||
where D: de::Deserializer
|
||||
{
|
||||
deserializer.visit(DateTimeVisitor).map(|dt| dt.with_timezone(&UTC))
|
||||
deserializer.deserialize(DateTimeVisitor).map(|dt| dt.with_timezone(&UTC))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -419,7 +419,7 @@ mod serde {
|
|||
fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error>
|
||||
where D: de::Deserializer
|
||||
{
|
||||
deserializer.visit(DateTimeVisitor).map(|dt| dt.with_timezone(&Local))
|
||||
deserializer.deserialize(DateTimeVisitor).map(|dt| dt.with_timezone(&Local))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1061,7 +1061,7 @@ mod serde {
|
|||
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error>
|
||||
where S: ser::Serializer
|
||||
{
|
||||
serializer.visit_str(&format!("{:?}", self))
|
||||
serializer.serialize_str(&format!("{:?}", self))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1073,7 +1073,7 @@ mod serde {
|
|||
fn visit_str<E>(&mut self, value: &str) -> Result<NaiveDate, E>
|
||||
where E: de::Error
|
||||
{
|
||||
value.parse().map_err(|err| E::syntax(&format!("{}", err)))
|
||||
value.parse().map_err(|err| E::custom(format!("{}", err)))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1081,7 +1081,7 @@ mod serde {
|
|||
fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error>
|
||||
where D: de::Deserializer
|
||||
{
|
||||
deserializer.visit(NaiveDateVisitor)
|
||||
deserializer.deserialize(NaiveDateVisitor)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -324,7 +324,7 @@ mod serde {
|
|||
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error>
|
||||
where S: ser::Serializer
|
||||
{
|
||||
serializer.visit_str(&format!("{:?}", self))
|
||||
serializer.serialize_str(&format!("{:?}", self))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -336,7 +336,7 @@ mod serde {
|
|||
fn visit_str<E>(&mut self, value: &str) -> Result<NaiveDateTime, E>
|
||||
where E: de::Error
|
||||
{
|
||||
value.parse().map_err(|err| E::syntax(&format!("{}", err)))
|
||||
value.parse().map_err(|err| E::custom(format!("{}", err)))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -344,7 +344,7 @@ mod serde {
|
|||
fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error>
|
||||
where D: de::Deserializer
|
||||
{
|
||||
deserializer.visit(NaiveDateTimeVisitor)
|
||||
deserializer.deserialize(NaiveDateTimeVisitor)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -583,7 +583,7 @@ mod serde {
|
|||
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error>
|
||||
where S: ser::Serializer
|
||||
{
|
||||
serializer.visit_str(&format!("{:?}", self))
|
||||
serializer.serialize_str(&format!("{:?}", self))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -595,7 +595,7 @@ mod serde {
|
|||
fn visit_str<E>(&mut self, value: &str) -> Result<NaiveTime, E>
|
||||
where E: de::Error
|
||||
{
|
||||
value.parse().map_err(|err| E::syntax(&format!("{}", err)))
|
||||
value.parse().map_err(|err| E::custom(format!("{}", err)))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -603,7 +603,7 @@ mod serde {
|
|||
fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error>
|
||||
where D: de::Deserializer
|
||||
{
|
||||
deserializer.visit(NaiveTimeVisitor)
|
||||
deserializer.deserialize(NaiveTimeVisitor)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue