-
-
Notifications
You must be signed in to change notification settings - Fork 772
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
Make serde-derive's implicit peer dependency on serde optional #1147
Comments
Not really. If there's a crate that depends on |
Hm, true. That's really unfortunate, though. I'd love to do this in some way that isn't "fork every proc macro and change stuff to |
Maybe |
That would be a pretty good solution. But… Wasn't there some reason not to do that? Can you access proc_macro crates' items like that?
… Am 22.01.2018 um 11:34 schrieb Oliver Schneider ***@***.***>:
Maybe serde_derive can reexport serde and then do use ::serde_derive::_serde;? It's not like it makes any sense to have serde_derive without serde.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I agree we need a better story here. The I expect it will be tricky but perhaps not impossible to have serde_derive re-export and refer to serde. The trouble is serde already optionally re-exports serde_derive and that would be broken by a circular dependency. |
Sorry for bothering. Is there any news about this issue? |
Perhaps a helper attribute could be added to optionally specify the identifier for the serde crate? use serde as panini;
#[derive(Serialize, Deserialize)]
#[serde(import = "panini")]
struct Key(i32); The proc_macro would then retrieve the import identifier an use |
That's implemented as #[serde(crate = "panini")]. |
So, I have a very weird request. I'm trying to re-export serde-derive in my quicli crate, but since this code
serde/serde_derive/src/de.rs
Lines 63 to 69 in 1bdf5ec
expands to
extern crate serde as _serde
, my consumers would have to add serde to their dependencies—which I want to avoid (the selling point of the crate is to only add it as dependency). Is there another option of doing this? E.g., making this part of the derive optional (with a feature flag)?cc killercup/quicli#9
The text was updated successfully, but these errors were encountered: