the current macro namespace is a bit tricky, since macros are not proper items, they have "textual scope", they are exported directly at the root of the crate, so you can write it like this:
/// use the [`Exclusive`](macro@crate::Exclusive) macro
You can opt in to a macro also having normal path scoping by useing it:
pub mod some_module {
macro_rules! foo { () => {} }
pub(crate) use foo; // causes `crate::some_module::foo` to exist
#[macro_export]
macro_rules! bar { () => {} }
pub use bar; // causes `crate::some_module::bar` to exist
}
Note that if you want the macro to be visible outside the crate, as in bar above, you must also write#[macro_export], and that will export it from the crate root too.
If you would like the macro to be in a non-root module only, then that is not currently possible, but you can fake it with careful use of #[doc(hidden)] and #[doc(inline)]:[1]
pub mod some_module {
#[doc(hidden)]
#[macro_export]
macro_rules! _some_module_private_baz { () => {} }
/// Documentation for the macro blah blah blah.
#[doc(inline)]
pub use _some_module_private_baz as baz;
}
Without the #[doc(inline)], the documentation will still appear in the crate’s documentation but not in cross-crate reexports, if I remember correctly. ↩︎