Serializer
is a trait that allows for data serialization and deserialization
similar to Borsh, but via a separate trait. This allows for serialization
of additional metadata while using underlying Borsh primitives. For example:
a struct can implement both Borsh and Serializer traits where Serializer
can store custom metadata (e.g. struct version) and then store the struct
using Borsh. Both
Serializer
and Borsh are almost identical, where
Serializer
is meant to signal intent for custom serialization.
Serializer
is a complimentary trait for
Serializable
struct
and can be used to prevent direct Borsh serialization of a struct.