#[macro_v]Expand description
Attribute that make the visibility of the macro_rules! macro the same as
other items.
So the usage of #[macro-v] is private by default, as is the visibility of
other items. For example:
// Use before declaration
private_macro!();
#[macro_v]
macro_rules! private_macro {
() => {};
}
mod inner {
// You must use the prefix `super::` or `crate::` to call the macro,
// because it is not in the current scope
super::private_macro!();
crate::private_macro!();
}You can also use #[macro_v(pub(crate))] to make the macro visible in the
current crate. For example:
inner::example_macro!();
// No `#[macro_use]` needed!
mod inner {
use macro_v::macro_v;
#[macro_v(pub(crate))]
macro_rules! example_macro {
() => {};
}
}Defining public macros also no longer requires #[macro_export], but
instead uses #[macro-v(pub)]. For example:
pub mod inner {
use macro_v::macro_v;
#[macro_v(pub)]
macro_rules! public_macro {
() => {};
}
}
crate::inner::public_macro!();