lloydmeta / frunk

Funktional generic type-level programming in Rust: HList, Coproduct, Generic, LabelledGeneric, Validated, Monoid and friends.
https://beachape.com/frunk/
MIT License
1.28k stars 58 forks source link

(C-SERDE) the serde feature should be named "serde" #97

Closed ExpHP closed 6 years ago

ExpHP commented 6 years ago

See C-SERDE in the Rust API guidelines

Note it is not actually possible to name a feature the same as a dependency. Rather, serde provides a "derive" feature specifically for this purpose.

lloydmeta commented 6 years ago

Oh interesting; I didn't know about these guidelines. Definitely a good idea to follow the convention.

For the sake of being tiringly explicit, it looks like we need to:

  1. Put the serde dependency behind a derive feature
  2. Use serde as a feature flag.

I wonder if we should add mention this in the README as well.

ExpHP commented 6 years ago

Nah, you just remove serde_derive as a dependency, and enable the derive feature on your serde dependency. (and don't set up any feature explicitly for serde). Users of frunk don't need to worry/know about this derive thing.

If you do this, then the only feature exposed by frunk will be called serde (it will be the feature autogenerated by cargo because serde is an optional dep)

But yes I do think you should mention something in the readme. (The user needs to add features =. ["serde"] to their frunk dep to get serde derives.)

lloydmeta commented 6 years ago

If you do this, then the only feature exposed by frunk will be called serde (it will be the feature autogenerated by cargo because serde is an optional dep)

Oh nice; didn't know this was possible 😎