O'Reilly logo

Network Programming with Rust by Abhishek Chanda

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 2Introduction 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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required