Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

Useful Crates for Macro Development

syn

Syn is a parsing library for parsing a stream of Rust tokens into a syntax tree of Rust source code.

quote

Quote provides the quote! macro for turning Rust syntax tree data structures into tokens of source code.

proc-macro2

proc-macro2 is a substitute implementation of the compiler’s proc_macro API to decouple token-based libraries from the procedural macro use case.

syntactic-for

syntactic-for provides a syntactic “for” loop Rust macro.

Declarative Macros

macro_rules! add{
    ($a:expr,$b:expr)=>{{
               $a+$b
    }}
}
add!(2, 3)