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
Serde does not allow to convey any extra metadata during serialization. Using special new type structs, it could be possible to work around it. Newtype structs can be serialized by an extra call to serialize_newtype_struct, this way it would be possible to inject additional metadata via the typename.
Possible uses:
Bool8
Datetimes
While the newtype could be ignored in array serialization and deserialization, it could be used during schema tracing.
The alternate API is nicer, as attr annotations over fields can get "noisy" very quickly. Newtype hides it away as a one-time def.
Thank you for thinking through this!
Serde does not allow to convey any extra metadata during serialization. Using special new type structs, it could be possible to work around it. Newtype structs can be serialized by an extra call to
serialize_newtype_struct
, this way it would be possible to inject additional metadata via the typename.Possible uses:
While the newtype could be ignored in array serialization and deserialization, it could be used during schema tracing.
This idea is motivated by this comment.
Possible API
Mock Impl for Marker Type
The text was updated successfully, but these errors were encountered: