From c3b9a26bb080fae9e61bc14ee2b899239d40210f Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Tue, 16 Aug 2016 02:54:11 -0400 Subject: [PATCH] Support deserializing from bincode Bincode is a minimal format that expects the Deserialize implementation to tell it what type of data it should expect to see. --- src/datetime.rs | 6 +++--- src/naive/date.rs | 2 +- src/naive/datetime.rs | 2 +- src/naive/time.rs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/datetime.rs b/src/datetime.rs index a0326cc..a0bf400 100644 --- a/src/datetime.rs +++ b/src/datetime.rs @@ -496,7 +496,7 @@ mod serde { fn deserialize(deserializer: &mut D) -> Result where D: de::Deserializer { - deserializer.deserialize(DateTimeVisitor) + deserializer.deserialize_str(DateTimeVisitor) } } @@ -504,7 +504,7 @@ mod serde { fn deserialize(deserializer: &mut D) -> Result where D: de::Deserializer { - deserializer.deserialize(DateTimeVisitor).map(|dt| dt.with_timezone(&UTC)) + deserializer.deserialize_str(DateTimeVisitor).map(|dt| dt.with_timezone(&UTC)) } } @@ -512,7 +512,7 @@ mod serde { fn deserialize(deserializer: &mut D) -> Result where D: de::Deserializer { - deserializer.deserialize(DateTimeVisitor).map(|dt| dt.with_timezone(&Local)) + deserializer.deserialize_str(DateTimeVisitor).map(|dt| dt.with_timezone(&Local)) } } diff --git a/src/naive/date.rs b/src/naive/date.rs index 61bff19..770279a 100644 --- a/src/naive/date.rs +++ b/src/naive/date.rs @@ -1581,7 +1581,7 @@ mod serde { fn deserialize(deserializer: &mut D) -> Result where D: de::Deserializer { - deserializer.deserialize(NaiveDateVisitor) + deserializer.deserialize_str(NaiveDateVisitor) } } diff --git a/src/naive/datetime.rs b/src/naive/datetime.rs index 1249611..e583d8e 100644 --- a/src/naive/datetime.rs +++ b/src/naive/datetime.rs @@ -1143,7 +1143,7 @@ mod serde { fn deserialize(deserializer: &mut D) -> Result where D: de::Deserializer { - deserializer.deserialize(NaiveDateTimeVisitor) + deserializer.deserialize_str(NaiveDateTimeVisitor) } } diff --git a/src/naive/time.rs b/src/naive/time.rs index 4c26533..12d12b0 100644 --- a/src/naive/time.rs +++ b/src/naive/time.rs @@ -1268,7 +1268,7 @@ mod serde { fn deserialize(deserializer: &mut D) -> Result where D: de::Deserializer { - deserializer.deserialize(NaiveTimeVisitor) + deserializer.deserialize_str(NaiveTimeVisitor) } }