rust-dlopen icon indicating copy to clipboard operation
rust-dlopen copied to clipboard

Re-Export the derive macro from the dlopen crate

Open DusterTheFirst opened this issue 3 years ago • 1 comments

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 avatar Dec 07 '20 18:12 DusterTheFirst

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

DusterTheFirst avatar Dec 07 '20 18:12 DusterTheFirst