Skip to content

Chapter 4 - Section Serialization and Deserialization - Cargo.toml dependency for serde needs text for feature "derive" #8

Description

@glafrance

In chapter 4, in the section entitled "Serialization and Deserialization", it indicates we must add this to our dependencies in Cargo.toml:

[dependencies]
serde = "1.0"
serde_json = "1.0"

But for the code to run it should be:

[dependencies]
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"

Without these changes cargo build gives errors, such as:

error: cannot find derive macro Serialize in this scope
--> src/main.rs:4:10
|
4 | #[derive(Serialize, Deserialize, Debug)]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions