Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upRe-export derives from serde #820
Conversation
dtolnay
assigned
oli-obk
Mar 21, 2017
dtolnay
force-pushed the
reexport
branch
from
5bbcbf4
to
1388643
Mar 21, 2017
oli-obk
reviewed
Mar 22, 2017
| // # struct S { /* ... */ } | ||
| // | ||
| // The reason re-exporting is not enabled by default is that disabling it would | ||
| // be annoying for crates that provide handwritten impls or data formats. They |
This comment has been minimized.
This comment has been minimized.
oli-obk
Mar 22, 2017
Member
that provide only handwritten impls
I'd say these are really rare. I think the usability of serde increases a lot if the serde crate reexports the derive macros by default.
oli-obk
reviewed
Mar 22, 2017
| // | ||
| // # Used like this: | ||
| // # #[cfg(feature = "serde")] | ||
| // # #[macro_use] |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
On crates.io, of the 438 crates that depend on serde >=0.9, 17% of them do not depend on serde_derive.
Some broad categories are:
And lots more miscellaneous situations. I think this shows that depending on serde but not serde_derive is a fairly common and diverse use case. For comparison, pretty much the same fraction of crates (19%) depend on serde >=0.9 but not serde_json so I don't think the number by itself justifies enabling the re-export by default. All three of serde and serde_derive and serde_json provide well-factored and distinguishable functionality so it is fair to expect users to depend on what they need. I think this change is a last resort for the use case explained in the comment - preserving sanity around a serde cargo cfg. I do not intend to push this as the recommended way to import derives. |
dtolnay commentedMar 21, 2017
Fixes #797. @oli-obk I am still not settled on whether this should be on or off by default but I am leaning toward off.