Summary
In this chapter, we discussed serialization and deserialization processes using the serde crate. We looked at how serde supports multiple formats and can automatically derive Serialize and Deserialize implementations for structs or enumerations. We implemented a service that generates random numbers from incoming parameters serialized in JSON format.
After that, you learned how to implement these traits yourself and add extra features to shuffle an array or to generate a random color. Finally, we discussed how to support multiple formats in one handler.
In the next chapter, you'll learn how to use full potential of asynchronous code, and write microservices with Rust that can handle thousands of clients simultaneously.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access