# A Practical Introduction to Derive Macros in Rust

**URL:** <https://users.rust-lang.org/t/a-practical-introduction-to-derive-macros-in-rust/93572>\
**Category:** tutorials\
**Created:** [May 6, 2023, 8:24am UTC](https://users.rust-lang.org/t/a-practical-introduction-to-derive-macros-in-rust/93572 "2023-05-06T08:24:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![erayerdin](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/erayerdin/32/33818_2.png) [@erayerdin](https://users.rust-lang.org/u/erayerdin)\
**Post date:** [May 6, 2023, 8:24am UTC](https://users.rust-lang.org/t/a-practical-introduction-to-derive-macros-in-rust/93572/1 "2023-05-06T08:24:05Z")

</div>

Hey, people. I've just published a video about a practical introduction to derive macros. The video has a dead-simple example, which will help you understand the basics of derive _and procedural_ macros.

[![](https://img.youtube.com/vi/XY0yR6IPbhw/maxresdefault.jpg "A Practical Introduction to Derive Macros in Rust") ](https://www.youtube.com/watch?v=XY0yR6IPbhw)

---

<div class="post-metadata">

**Author:** ![steffahn](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/steffahn/32/47569_2.png) [@steffahn](https://users.rust-lang.org/u/steffahn)\
**Post date:** [May 6, 2023, 8:48am UTC](https://users.rust-lang.org/t/a-practical-introduction-to-derive-macros-in-rust/93572/2 "2023-05-06T08:48:50Z")

</div>

Can’t help but notice the typo “Procedular” on one of the earlier slides 😅

Besides a few typos, I like the video!

I believe characterizing `quote` as the inverse of `syn` is maybe a bit inaccurate, as turning the syntax tree back into tokens is _implemented_ in `syn` as well, `quote` only offers the framework for this conversion, via the `ToTokens` trait, as well as the `quote` macro, which can be useful on its own when manually working with token streams only, but also interacts with `ToTokens` nicely.

---

<div class="post-metadata">

**Author:** ![erayerdin](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/erayerdin/32/33818_2.png) [@erayerdin](https://users.rust-lang.org/u/erayerdin)\
**Post date:** [May 7, 2023, 6:44am UTC](https://users.rust-lang.org/t/a-practical-introduction-to-derive-macros-in-rust/93572/3 "2023-05-07T06:44:13Z")

</div>

> [@steffahn](#):
>
> Can’t help but notice the typo “Procedular” on one of the earlier slides

Hold on, where's the typo?

> [@steffahn](#):
>
> I like the video!

Thank you.

---

<div class="post-metadata">

**Author:** ![steffahn](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/steffahn/32/47569_2.png) [@steffahn](https://users.rust-lang.org/u/steffahn)\
**Post date:** [May 7, 2023, 6:44am UTC](https://users.rust-lang.org/t/a-practical-introduction-to-derive-macros-in-rust/93572/4 "2023-05-07T06:44:44Z")

</div>

> [@erayerdin](#):
>
> Hold on, where's the typo?

Appearing around the [0:18](https://youtu.be/XY0yR6IPbhw?t=18) timestamp 😉

 ![Screenshot_20230507_154531](https://us1.discourse-cdn.com/flex019/uploads/rust_lang/original/3X/3/4/34c3902787b1fcfc7b7d2194d621a02d479ceb2c.jpeg)

---

<div class="post-metadata">

**Author:** ![erayerdin](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/erayerdin/32/33818_2.png) [@erayerdin](https://users.rust-lang.org/u/erayerdin)\
**Post date:** [May 7, 2023, 7:44am UTC](https://users.rust-lang.org/t/a-practical-introduction-to-derive-macros-in-rust/93572/5 "2023-05-07T07:44:54Z")

</div>

i was gonna send darwin's sad dance scene but probably have found the best edit of it lol

[![](https://img.youtube.com/vi/krTcJpblCCU/maxresdefault.jpg "Gumball and Darwin dancing sad dance for an entire hour because Half Life 3 will not come out.") ](https://www.youtube.com/watch?v=krTcJpblCCU)

this typo will probably haunt me before i sleep tonight. 😆

---

<div class="post-metadata">

**Author:** ![system](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/system/32/51372_2.png) [@system](https://users.rust-lang.org/u/system)\
**Post date:** [August 5, 2023, 7:45am UTC](https://users.rust-lang.org/t/a-practical-introduction-to-derive-macros-in-rust/93572/6 "2023-08-05T07:45:23Z")

</div>

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.
