From 0a32cea26e70639b3569deb246338cff71d59bc6 Mon Sep 17 00:00:00 2001 From: Erick Tryzelaar Date: Sat, 23 Jan 2016 16:07:50 -0800 Subject: [PATCH] feat(impls): Allow options to be deserialized from units --- serde/src/de/impls.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/serde/src/de/impls.rs b/serde/src/de/impls.rs index 1e5f5770..ef696484 100644 --- a/serde/src/de/impls.rs +++ b/serde/src/de/impls.rs @@ -283,6 +283,13 @@ impl< > Visitor for OptionVisitor { type Value = Option; + #[inline] + fn visit_unit(&mut self) -> Result, E> + where E: Error, + { + Ok(None) + } + #[inline] fn visit_none(&mut self) -> Result, E> where E: Error,