Closed ryan-summers closed 2 years ago
I have been looking at this extensively, and there's a number of reasons why we may want to avoid using serde for this:
#[derive(Deserialize, Serialize)]
on them, as the enum position is encoded as opposed to the property ID.deserialize
and serialize
for properties is not possible without restructuring the Property
, as we need to deserialize multiple values (the property and the value), but the serde traits consume deserializer
when deserializing a single value.After an implementation in #101, it was found that many of the drawbacks can be worked around through custom implementation of a deserializer
. There is a small amount of manual impl Deserialize
and impl Serialize
required for the properties and packets themselves, but the rest of the types may be derived
at will.
Refactor the serialization and deserialization of packets. In an ideal world, we should use
serde
to handle all types of serial/deserialization operations if possible.