Serialization and deserialization using Serde

Serde is the de-facto standard way of serializing and deserializing data in Rust. Serde supports a number of data structures that it can serialize out of the box to a number of given data formats (including JSON, and TOML, CSV). The easiest way to understand Serde is to think of it as an invertible function that transforms a given data structure into a stream of bytes. Other than standard data types, Serde also provides a few macros that can be implemented on user defined data types, making them (de)serializable.

In Chapter 2, Introduction to Rust and its Ecosystem, we discussed how procedural macros can be used to implement custom derives for given data types. Serde uses that mechanism to provide ...

Get Network Programming with Rust now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.