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.
This commit is contained in:
David Tolnay 2016-08-16 02:54:11 -04:00
parent 8b382fca45
commit c3b9a26bb0
4 changed files with 6 additions and 6 deletions

View File

@ -496,7 +496,7 @@ mod serde {
fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error> fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error>
where D: de::Deserializer where D: de::Deserializer
{ {
deserializer.deserialize(DateTimeVisitor) deserializer.deserialize_str(DateTimeVisitor)
} }
} }
@ -504,7 +504,7 @@ mod serde {
fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error> fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error>
where D: de::Deserializer 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<D>(deserializer: &mut D) -> Result<Self, D::Error> fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error>
where D: de::Deserializer where D: de::Deserializer
{ {
deserializer.deserialize(DateTimeVisitor).map(|dt| dt.with_timezone(&Local)) deserializer.deserialize_str(DateTimeVisitor).map(|dt| dt.with_timezone(&Local))
} }
} }

View File

@ -1581,7 +1581,7 @@ mod serde {
fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error> fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error>
where D: de::Deserializer where D: de::Deserializer
{ {
deserializer.deserialize(NaiveDateVisitor) deserializer.deserialize_str(NaiveDateVisitor)
} }
} }

View File

@ -1143,7 +1143,7 @@ mod serde {
fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error> fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error>
where D: de::Deserializer where D: de::Deserializer
{ {
deserializer.deserialize(NaiveDateTimeVisitor) deserializer.deserialize_str(NaiveDateTimeVisitor)
} }
} }

View File

@ -1268,7 +1268,7 @@ mod serde {
fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error> fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error>
where D: de::Deserializer where D: de::Deserializer
{ {
deserializer.deserialize(NaiveTimeVisitor) deserializer.deserialize_str(NaiveTimeVisitor)
} }
} }