3Hren/msgpack-rust

Option serializing is fundamentally broken

Zoxc opened this issue · 1 comments

Zoxc commented

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.

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