You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to re-export a trait (e.g. AsBytes) and its respective derive macro in a crate and invoke that macro in a downstream crate. It seems, however, that the derive macros assume that zerocopy is one of the invoker's imported crates. Here is a minimal example:
Hey @ozaner, thanks for reaching out about this! We're aware of the issue and have it tracked in #11. We plan on taking an approach similar to Serde's, although implementing it isn't on our immediate roadmap. I'm gonna close this in favor of that issue, but feel free to follow up with more comments!
But I can't really find where it is implemented. Is there any way to achieve this, that is, reexport zerocopy without having downstream needing to import it? I don't mind if its messy or full of boilerplate.
Thought I'd follow up here rather than pollute the original issue with irrelevant comments on the details of workarounds.
I want to re-export a trait (e.g.
AsBytes
) and its respective derive macro in a crate and invoke that macro in a downstream crate. It seems, however, that the derive macros assume thatzerocopy
is one of the invoker's imported crates. Here is a minimal example:my_reexport crate (deps: zerocopy w/ derive feature)
lib.rs
my_app crate (deps: my_reexport)
main.rs
I get an error highlighted on the
AsBytes
item in the derive macro:I think other crates solve this problem by providing a
crate
attribute to their derives, for exampleserde has
#[serde(crate = "...")]
.Apologies if there is already a way to do this, but I haven't found any documentation on the matter.
The text was updated successfully, but these errors were encountered: