How to control visibility of declarative macro?

Rust has a supreme system for control visibility and privacy. However, I can't find a way to apply the visibility modifier to declarative macro (the macro defined using macro_rules!).

What I want is:

Macro m! is defined in pub module a, and I want the visibility of m! is equivalent to pub(crate).

The only related is #[macro_export] and #[macro_use], but if I use #[macro_export] to the m!, this macro use public outside the crate.

You just need to write #[macro_use] on pub mod a, then it will be available anywhere after there.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.