schema: serialize enum unit variants

... since deserializing them already works

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
This commit is contained in:
Hannes Laimer 2023-08-29 11:59:16 +02:00 committed by Thomas Lamprecht
parent 498341ec0d
commit 92be86d776

View File

@ -483,14 +483,13 @@ impl<T: fmt::Write> Serializer for ElementSerializer<T> {
}
fn serialize_unit_variant(
self,
name: &'static str,
mut self,
_name: &'static str,
_index: u32,
variant: &'static str,
) -> Result<Self::Ok, Error> {
Err(Error::msg(format!(
"tried to serialize a unit variant ({name}::{variant})"
)))
self.inner.write_str(variant)?;
Ok(self.inner)
}
fn serialize_newtype_struct<V>(self, _name: &'static str, value: &V) -> Result<T, Error>