This is the code for Manning's Write Powerful Rust Macros book.
The code is organized by chapter. Exercise solutions are not located in a separate appendix directory, instead they sit next to the example code for the chapter they appeared in, and always end in -exercise
.
Every project besides the exercise solutions represents either a complete example, or (since many chapters are based around a single example) show stages in the development of that example.
Each one contains a README file that gives some idea what part of the chapter it is related to.
The util
directory contains a script, create_setup.sh
that allows you to generate procedural macro setups like the ones used in this book, with either 1, 2, or 3 subdirectories.
All three options are explored in the book.
Usage:
./create_setup.sh name 2
Section 1.2 (page 4)
C++, not C, has templates
Section 1.3.2 (page 7)
#[derive(Clone)}
should be #[derive(Clone)]
Section 2.1.4 (page 15)
"Nonemtpy" in the title should be "nonempty"
Section 2.4 (page 39)
"trailing comments" should be "trailing commas"
Appendix (page 260)
"trailing comments" should be "trailing commas"