How to re-export only one macro?

I know that if you write:

pub use external_crate::*;

all of external_crate's macros will be re-exported. But what do I do if I want to re-export just one macro?

Can’t you just do pub use external_crate::some_interesting_macro; like with normal code?

EDIT: Have a look at the RFC for reforming macros which was merged at the end of 2014. To re-export a macro from some other crate so people can use it when importing your crate, use #[macro_reexport(vec)] extern crate external_crate;.

Looks like it’s being deprecated soon. I guess the first way is the way to go on nightly, with #![feature(use_extern_macros)].

I was just going to suggest trying the new 2018 edition module system :slight_smile:

#![feature(rust_2018_preview, use_extern_macros)]

pub use external_crate::some_macro;
1 Like