fu5ha / ultraviolet

A wide linear algebra crate for games and graphics.
https://crates.io/crates/ultraviolet
750 stars 81 forks source link

Matrix serialization is length-delimited but deserialization isn't #138

Closed danielkeller closed 2 years ago

danielkeller commented 2 years ago

For example, with bincode, the following assertion fails:

let unit = Mat4::identity();
assert_eq!(
    unit,
    bincode::deserialize::<Mat4>(&bincode::serialize(&unit).unwrap()).unwrap()
);

It looks like the serializer inserts a length that the deserializer doesn't read.

AlphaModder commented 2 years ago

This occurs because the Serialize impl calls serialize_seq but the Deserialize impl calls deserialize_tuple. ron is also affected. I have opened a PR #140 to fix this.