macro

Textual scope and path-based macro imports

A macro defined with macro_rules! becomes available textually after its declaration. Re-exporting it with use also permits explicit path lookup within the allowed visibility. Expected stdout (not executed): 'ready\n' Common mistake: Assuming an ordinary macro declaration automatically creates a public module path.

Formal Syntax & Structure

rust syntaxrust
pub(crate) use name;

Working Example

Example Snippetrust
mod tools {    macro_rules! badge { () => { "ready" }; }    pub(crate) use badge;}fn main() { println!("{}", tools::badge!()); }
Rust Reference