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

Missing "derive" feature for serde dependency? #162

Closed
paulgoetze opened this issue May 23, 2021 · 3 comments
Closed

Missing "derive" feature for serde dependency? #162

paulgoetze opened this issue May 23, 2021 · 3 comments

Comments

@paulgoetze
Copy link

paulgoetze commented May 23, 2021

Hey Jérémie, I was just trying to update the Elixir mjml_nif lib to use mrml v1.2.2 and came across this error when compiling the crate:

Compiling mrml v1.2.2
error[E0433]: failed to resolve: could not find `Serialize` in `serde`
  --> /home/paul/.asdf/installs/rust/1.51.0/registry/src/github.com-1ecc6299db9ec823/mrml-1.2.2/src/mj_accordion/children.rs:16:44
   |
16 | #[cfg_attr(feature = "json", derive(serde::Serialize, serde::Deserialize))]
   |                                            ^^^^^^^^^ could not find `Serialize` in `serde`

error[E0433]: failed to resolve: could not find `Deserialize` in `serde`
  --> /home/paul/.asdf/installs/rust/1.51.0/registry/src/github.com-1ecc6299db9ec823/mrml-1.2.2/src/mj_accordion/children.rs:16:62
   |
16 | #[cfg_attr(feature = "json", derive(serde::Serialize, serde::Deserialize))]
   |                                                              ^^^^^^^^^^^ could not find `Deserialize` in `serde`

The dependencies in my Cargo.toml looked like this when compiling failed:

[dependencies]
rustler = "0.22.0-rc.1"
mrml = "1.2.2"

When I put an additonal explicit serde dependency with reference to its derive feature, like the following, compiling succeeds:

[dependencies]
rustler = "0.22.0-rc.1"
serde = { version = "1.0", features = ["derive"] }
mrml = "1.2.2"

(This also fetches an additional serde_derive v1.0.126)

I'm not too familiar with serde and the usage of macros, but might there be a missing features = ["derive"] for the serde dependency (or an explicit serde_derive dependency) in the mrml-core Cargo.toml?

Or did I miss sth. that changed from mrml v1.0.0 to v1.2.2 in terms of setup/installation?

@jdrouet
Copy link
Owner

jdrouet commented May 23, 2021

@paulgoetze thanks for this issue, I completely forgot to update the installation steps. You do need to install serde = { version = "1.0", features = ["derive"] }.

If you don't need the json part, you can do the following

mrml = { version = "1.2", default-features = false, features = ["parse", "render"] }

@paulgoetze
Copy link
Author

Thanks a lot @jdrouet - the latter works perfectly in my use case.
Also you get the Quickest-Maintainer-Reply-Award (weekend edition) 🏆 😉

@jdrouet
Copy link
Owner

jdrouet commented May 23, 2021

Thank you very much! I'll keep it on my desk!

@jdrouet jdrouet closed this as completed May 23, 2021
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