Skip to content

Mention the derive feature in the overview page #2907

Open
@GwenTheKween

Description

@GwenTheKween

I'm a new user of serde (as rust as a whole), and based on looking at the Overview page in the documentation, it seemed that all I needed was to include serde as a dependency and copy the example code in the page.

Much to my dismay, that was not the case.

Hidden in the "Derive" section, it explains that to actually get the example code in "Overview" to work, I need to choose the feature "derive".

This is quite an unintuitive way to write the documentation, and based on issue #1586 and this other question[1] it seems like I'm not the only one confused.

My suggestion is that the overview page should mention requiring the feature for the example code to work, perhaps with the following addition to the preceeding paragraph (emphasis mine):

Out of the box, Serde is able to serialize and deserialize common Rust data types in any of the above formats. For example String, &str, usize, Vec, HashMap<K,V> are all supported. In addition, if the derive feature is requested (see: Derive), Serde provides a derive macro to generate serialization implementations for structs in your own program. Using the derive macro goes like this:

[1] https://users.rust-lang.org/t/serde-cannot-find-derive-macro-deserialize-serialize-in-this-scope/79402

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions