macro
Procedural macro crate architecture
Place compiler-facing macro functions at the root of a proc-macro library. A separate consumer crate imports them. The supplied workspace uses a local path dependency and marks both packages unpublished. Example: two-crate workspace; see fixtures/proc-macro-workspace/consumer/src/bin/architecture.rs. This caller is not a standalone rustc program. Expected stdout (not executed): '7\n' Common mistake: Calling a macro from the same crate that defines it.
Formal Syntax & Structure
rust syntaxrust
[lib]proc-macro = trueWorking Example
Example Snippetrust
use teaching_macros::seven;fn main() { println!("{}", seven!()); }