msgpack-rust icon indicating copy to clipboard operation
msgpack-rust copied to clipboard

Option serializing is fundamentally broken

Open Zoxc opened this issue 3 years ago • 1 comments

It doesn't serialize the enumerator.

fn serialize_some<T: ?Sized + serde::Serialize>(self, v: &T) -> Result<(), Self::Error> {
    v.serialize(self)
}

It would probably make sense to change this to encode None as a 0-sized array and Some as a 1-sized array.

Zoxc avatar Aug 24 '22 19:08 Zoxc

Yes, it tries to be clever by using null for None, but that can't express nesting.

kornelski avatar Aug 24 '22 20:08 kornelski