💾 Archived View for carnage.edvinbasil.com › knowledge › pl › rust › macros.md captured on 2020-11-07 at 00:34:37. Gemini links have been rewritten to link to archived content
-=-=-=-=-=-=-
Macros are basically code that generates other code.
There are mainly 2 kinds of macros in rust:
- Declarative macros
- Procedural macros/Proc Macros
Jonhoo did a nice beginner friendly video on declarative macros on his channel
[here](https://www.youtube.com/watch?v=q6paRBbLgNw)
- Seen in [smol](https://crates.io/crates/smol)
#[macro_export] macro_rules! my_macro { ($($expr:tt)*) => { $crate::MyStruct::myfunc(async move { $($expr)* }).await }; }