rust-macros

Installation
SKILL.md

Rust Macros

The first question a macro must answer is why it is not a function, a trait, or a generic — and usually the answer is that it is not.

A macro is a last resort

Most macros exist to avoid typing, and the cost they charge is paid by every reader afterwards: no jump-to-definition worth the name, error messages pointing at expansions, no type checking until the expansion happens. The genuine answers are three — a variadic interface, generating an impl per type from a list, and a DSL whose syntax is not Rust. Name the case; if it is not one of the three, reach for the non-macro and say which.

By-example before procedural

Installs
40
GitHub Stars
14
First Seen
Aug 16, 2026