macro
Export a macro at crate root
Export gives a macro a public crate-root path even if its definition is inside a module. The module path is not automatically an additional macro path. Expected stdout (not executed): 'ready\n' Common mistake: Calling crate::labels::status_label! without providing a separate re-export.
Formal Syntax & Structure
rust syntaxrust
#[macro_export] macro_rules! name { ... }Working Example
Example Snippetrust
mod labels { #[macro_export] macro_rules! status_label { () => { "ready" }; } }fn main() { println!("{}", crate::status_label!()); }