You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Rust a (De)Serialize for type T handles high level (de)serialization of that type - very simple and yet powerful concept. https://serde.rs/impl-serialize.html
In this library custom serializers are counterintuitive and less powerful because they are called on each field of the class rather than on the class type itself. And they don't allow for any control over serialization.
Custom serializer should allow you to control at least what you store and in what order.
E.g. I want to serialize an instance of A which can have subtypes B and C. I need to store some discriminator field so that I can pick correct type later for deserialization.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
In Rust a (De)Serialize for type T handles high level (de)serialization of that type - very simple and yet powerful concept.
https://serde.rs/impl-serialize.html
In this library custom serializers are counterintuitive and less powerful because they are called on each field of the class rather than on the class type itself. And they don't allow for any control over serialization.
Custom serializer should allow you to control at least what you store and in what order.
E.g. I want to serialize an instance of
A
which can have subtypesB
andC
. I need to store some discriminator field so that I can pick correct type later for deserialization.Beta Was this translation helpful? Give feedback.
All reactions