-
Notifications
You must be signed in to change notification settings - Fork 335
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
Figure out a way to support multiple versions of serde in-crate #320
Comments
Serde is willing to own the shim. I will send a PR to url once it's ready. |
@dtolnay Does something like |
Yes but it would be nightly only. |
#327 implements this using a |
Closing as we’ll likely not do this. Instead we’ll eventually make rust-url 2.0 without support for serde versions other than 1.x. In the meantime https://crates.io/crates/url_serde is not idea but can be used. |
This is a requirement for doing #304 without a breaking change.
@dtolnay suggested a plan along these lines:
serde_1_0
crate that depends on serde 1.0 and only containspub use serde::*;
. Make other similar crates for other mutually-incompatible versions of serde. (I’d rather the serde project maintain these crates, if they’re willing.)url
optionally depend on these crates, with Cargo feature flags namedserde_1_0
etc.Serialize
andDeserialize
traits. For exampleimpl serde_1_0::Serialize for Url {…} impl serde_0_9::Serialize for Url {…}
etc.url_serde
that is marked#[deprecated]
with a message that point to the feature flags.Open question: can
#[derive]
be used in this setup? How?These crates with a version number in the name are a hack to work around a limitation of Cargo: a crate can not depend on multiple crates with the same name. (That is, multiple mutually-incompatible versions of the same crate.) A better solution would be to make Cargo support that scenario directly. This probably involves locally renaming a dependency for disambiguating
extern crate
.Help wanted to write a Cargo RFC.
The text was updated successfully, but these errors were encountered: