diff --git a/src/parser/deserializer.rs b/src/parser/deserializer.rs index 48b4239f4f..d9d6853190 100644 --- a/src/parser/deserializer.rs +++ b/src/parser/deserializer.rs @@ -58,6 +58,12 @@ impl<'de> ConfigDeserializer<'de> { Ok(()) } + + pub fn top(&mut self) -> &DeserializerItem { + let value = self.stack.last(); + trace!("inspecting top value :: {:?}", value); + value.expect("Can't get top elemant of an empty stack") + } pub fn pop(&mut self) -> DeserializerItem { let value = self.stack.pop(); @@ -81,7 +87,7 @@ impl<'de, 'a> de::Deserializer<'de> for &'a mut ConfigDeserializer<'de> { V::Value::extract(&value.val) } - forward_to_deserialize_any! { bool option } + forward_to_deserialize_any! { bool } fn deserialize_i8(self, _visitor: V) -> Result where @@ -173,6 +179,19 @@ impl<'de, 'a> de::Deserializer<'de> for &'a mut ConfigDeserializer<'de> { { unimplemented!("deserialize_byte_buf") } + + fn deserialize_option(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + let value = self.top(); + let name = std::any::type_name::(); + trace!("