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

Ch2. serde Deserialize feature not explicit #51

Closed
tylerhjones opened this issue May 23, 2022 · 3 comments
Closed

Ch2. serde Deserialize feature not explicit #51

tylerhjones opened this issue May 23, 2022 · 3 comments

Comments

@tylerhjones
Copy link

info: The currently active `rustc` version is `rustc 1.63.0-nightly (cd282d7f7 2022-05-18)`
[dependencies]
anyhow = "1.0.57"
rayon = "1.5.3"
serde = "1.0.137"
thiserror = "1.0.31"

My model.rs file is the same as https://github.com/skerkour/black-hat-rust/blob/main/ch_02/tricoder/src/model.rs
yet the compiler complains

error: cannot find derive macro `Deserialize` in this scope
  --> src/model.rs:15:17
   |
15 | #[derive(Debug, Deserialize, Clone)]
   |                 ^^^^^^^^^^^
   |
note: `Deserialize` is imported here, but it is only a trait, without a derive macro
  --> src/model.rs:1:5
   |
1  | use serde::Deserialize;
   |     ^^^^^^^^^^^^^^^^^^

Your repo shows this import as a feature inclusion;

serde = { version = "1", features = ["derive"] }

but this is never mentioned in the book afaict.

@tylerhjones
Copy link
Author

tylerhjones commented May 23, 2022

I knew this error from prior experience, but it may not be known by other readers.

@sylvain101010
Copy link
Member

Thank you for the feedback!

At the moment I have no plan to change this, as I consider the GitHub repository as the source of truth for the code, while the book explains the code concepts.

The features feature was ruled out of scope of the book, but if more people report being confused, I may revisit this decision :)

@tylerhjones
Copy link
Author

👍🏻

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

No branches or pull requests

2 participants