serialize a key as <key/> instead of aborting as an error
@@ -32,10 +32,14 @@ where
type Ok = ();
type Error = DeError;
- fn serialize_key<T: ?Sized + Serialize>(&mut self, _: &T) -> Result<(), DeError> {
- Err(DeError::Unsupported(
- "impossible to serialize the key on its own, please use serialize_entry()",
- ))
+ fn serialize_key<T: ?Sized + Serialize>(&mut self, key: &T) -> Result<(), DeError> {
+ // Err(DeError::Unsupported(
+ // "impossible to serialize the key on its own, please use serialize_entry()",
+ //))
+ write!(self.parent.writer.inner(), "<").map_err(Error::Io)?;
+ key.serialize(&mut *self.parent)?;
+ write!(self.parent.writer.inner(), "/>").map_err(Error::Io)?;
+ Ok(())
}
fn serialize_value<T: ?Sized + Serialize>(&mut self, value: &T) -> Result<(), DeError> {
