Allow json missing fields to be treated as a null

Closes #34.
This commit is contained in:
Erick Tryzelaar
2015-03-12 20:44:16 -07:00
parent 5dd53e7ea3
commit dc87288f48
5 changed files with 82 additions and 4 deletions
+6
View File
@@ -291,6 +291,12 @@ pub trait MapVisitor {
fn size_hint(&self) -> (usize, Option<usize>) {
(0, None)
}
fn missing_field<V>(&mut self, field: &'static str) -> Result<V, Self::Error>
where V: Deserialize,
{
Err(Error::missing_field_error(field))
}
}
impl<'a, V_> MapVisitor for &'a mut V_ where V_: MapVisitor {