In previous chapters, we saw how macros and metaprogramming, in general, can make your life much easier. We saw both, macros that reduce the required boilerplate code and macros that will speed up your final code. It's time for you to learn how to create your own macros.
In this chapter, you will learn how to create your own standard macros, how to create your own procedural macros and custom derives, and finally, how to use nightly features to create your own plugins. You will also see how the new declarative macros work.
The chapter is divided into three sections:
- Macrosystem: Understanding the macro_rules!{} macro
- Procedural macros: Learning how to create your own custom derives
- Nightly metaprogramming: Plugins and declarative macros