-
Notifications
You must be signed in to change notification settings - Fork 750
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
Document how to support Serde as an optional library feature #1021
Comments
Related to this is a question about dependency versions; e.g. if Serde 2.0 is ever released, should a library provide |
Crates that want to support multiple Serde versions at once can use https://github.com/serde-rs/legacy. |
In https://serde.rs/derive.html , it is still suggested to declare |
I typically still prefer depending on serde_derive. The re-export from serde is intended for crates that optionally depend on serde and need derive along with it, which is uncommon. Other than that, I don't have a compelling argument in either direction. |
and will remain that way without a clear guide. Serde Legacy doesn't give much usage guide either. Is it possible to do something like Can a library seamlessly migrate from using a single version of Serde to using Serde Legacy to support multiple versions without breaking dependant crates? Is it likely that Serde 1 will be superseded in the future, or is there a promise never to release another breaking change? |
This is mentioned under feature flags and in the source.
It would be nice to have an example or at least mention under Using derive.
As I understand it, doing so involves this:
and this:
and this:
The text was updated successfully, but these errors were encountered: