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

Custom serialization and deserialization

As we saw before, Serde provides built-in serialization and deserialization for all primitive data types, and a number of complex data types, via macros. In some cases, however, Serde might fail to auto-implement. This might happen for more complex data types. In those cases, you will need to implement these manually. These cases demonstrate advanced usage of Serde, which also allows renaming fields in the output. For everyday usage, using these advanced feature is almost never necessary. These might be more common for networking, to handle a new protocol, and more.

Let's say we have a struct of three fields. We will just assume that Serde fails to implement Serialize and Deserialize on this, and so ...

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