mirror of
https://git.proxmox.com/git/perlmod
synced 2025-10-05 08:50:06 +00:00
fix enum serialization
For tuple variants we built the hash but discarded it and returned the inner array instead. For newtype variants we returned the raw hash instead of a reference to it. Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
3ddf67eb04
commit
f5adbcf1aa
@ -167,7 +167,7 @@ impl<'a> ser::Serializer for &'a mut Serializer {
|
|||||||
let value = value.serialize(&mut Serializer)?;
|
let value = value.serialize(&mut Serializer)?;
|
||||||
let hash = hash::Hash::new();
|
let hash = hash::Hash::new();
|
||||||
hash.insert(variant, value);
|
hash.insert(variant, value);
|
||||||
Ok(Value::from(hash))
|
Ok(Value::new_ref(&hash))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn serialize_seq(self, len: Option<usize>) -> Result<Self::SerializeSeq, Error> {
|
fn serialize_seq(self, len: Option<usize>) -> Result<Self::SerializeSeq, Error> {
|
||||||
@ -554,7 +554,7 @@ impl ser::SerializeTupleVariant for SerVariant<SerArray> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn end(self) -> Result<Value, Error> {
|
fn end(self) -> Result<Value, Error> {
|
||||||
Ok(Value::new_ref(&self.inner.array))
|
Ok(Value::new_ref(&self.hash))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user