Skip to content
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

Re-Export the derive macro from the dlopen crate #28

Open
DusterTheFirst opened this issue Dec 7, 2020 · 1 comment
Open

Re-Export the derive macro from the dlopen crate #28

DusterTheFirst opened this issue Dec 7, 2020 · 1 comment

Comments

@DusterTheFirst
Copy link

Currently, to use dlopen, the user needs 2 dependencies, one for the derive macro and one for the library itself

dlopen = "0.1"
dlopen_derive = "0.1"

as well as this extra dependency, crates also need to #[macro_use] the derive crate in order to use the macro

#[macro_use]
extern crate dlopen_derive;

This could be remedied by putting the above statement in the dlopen crate itself, much like how serde re-exports the Serialize and Deserialize dervive macros (https://github.com/serde-rs/serde/blob/master/serde/src/lib.rs#L278-L289). So the user would only need to use the trait and it would also import the macro under the same name.

It might also be possible to do this in the wrapper module rather than the crate root so that the user importing the trait use dlopen::wrapper::WrapperApi they would also import the derive macro of that name.

@DusterTheFirst
Copy link
Author

dlopen could also gate it behind a derive feature much like serde does if the macros are meant to be optional

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant