liveBook · Manning

Deserialize trait

As explained in Rust Servers, Services, and Apps

Deserialize is a deserialization trait that constructs values from an external data representation.

Deserialize constructs a Rust value from an external representation. In an Actix Web request, the client sends serialized data, and the framework deserializes it into a suitable input structure for application processing. section 6.2.1

Deserializing course creation input

Derive Deserialize on CreateCourse because the structure carries fields supplied by an API client. Keep internally generated fields such as course_id and posted_time out of this request type. Actix Web can deserialize the incoming JSON into web::Json<CreateCourse>, which can then be converted into CreateCourse with From; use TryFrom when conversion may fail. section 6.2.1

How Rust Servers, Services, and Apps covers it

How deep it goes
Explains derived deserialization and request-type conversion, but does not detail the serialization format or trait internals.
Examples
Uses CreateCourse and UpdateCourse request structs with derived Deserialize implementations.
What it assumes
Assumes Rust structs and HTTP request handling while teaching the distinction between client input and internal fields.
What you can do after
Apply it via Serde and Actix Web to accept JSON request data as typed Rust input.
How it connects
Connects Deserialize with Serialize, Actix Web, web::Json, From, and TryFrom.

Also explained in

Compare how 2 books explain deserialize trait →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Rust Servers, Services, and Apps. The section links point to the parts of the book it draws on.