Skip to main content

Module serializer

Module serializer 

Source
Expand description

The serializer::Serializer and serializer::Deserializer traits and their implementations.

Structs§

Serializable
Wrapper that routes Borsh serialization of the inner value through the Serializer/Deserializer traits, enabling custom metadata while preventing direct Borsh serialization of the wrapped type.

Traits§

Deserializer
Counterpart to Serializer that reconstructs a value from its custom serialized representation, complementing the Serializable wrapper.
DeserializerT
Blanket marker trait for any Deserializer that is also Send and Sync.
Serializer
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.
SerializerT
Blanket marker trait for any Serializer that is also Send and Sync.