diff options
author | aelita-mergebot <michaelhowell932+aelita@gmail.com> | 2016-09-19 02:09:39 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-19 02:09:39 -0700 |
commit | db248d7ea9ad1320a8aa44b408aea5f7f89ddd7b (patch) | |
tree | 57a06b51afe37a5d86794c7725c9f43aed294b12 /src/ser/value.rs | |
parent | 042a5eb0779dc38d3db3166ba997d4662ed6f5e7 (diff) | |
parent | f639279e3ea7c87ed418bb46e0f65f2017f6c19f (diff) |
Add support for option parameters
Merge #4 a=@mre r=@nox
________________________________________________________________________
Diffstat (limited to 'src/ser/value.rs')
-rw-r--r-- | src/ser/value.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/ser/value.rs b/src/ser/value.rs index 39d3af0..7a2ac42 100644 --- a/src/ser/value.rs +++ b/src/ser/value.rs @@ -158,13 +158,17 @@ impl<'key, 'target, Target> Serializer } fn serialize_none(&mut self) -> Result<(), Error> { - Err(Error::unsupported_value()) + if let Some(_) = self.key.take() { + Ok(()) + } else { + Err(Error::no_key()) + } } - fn serialize_some<T>(&mut self, _value: T) -> Result<(), Error> + fn serialize_some<T>(&mut self, value: T) -> Result<(), Error> where T: Serialize { - Err(Error::unsupported_value()) + value.serialize(self) } fn serialize_seq(&mut self, _len: Option<usize>) -> Result<(), Error> { |