Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mention the derive feature in the overview page #2907

Open
GwenTheKween opened this issue Mar 9, 2025 · 0 comments
Open

Mention the derive feature in the overview page #2907

GwenTheKween opened this issue Mar 9, 2025 · 0 comments

Comments

@GwenTheKween
Copy link

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

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

No branches or pull requests

1 participant