Write Powerful Rust Macros cover
welcome to this free extract from
an online version of the Manning book.
to read more
or
welcome

Welcome

 

Abandon all hope ye who enter he… I mean, thank you for purchasing the MEAP for Write Powerful Rust Macros! I wrote this book hoping to be of help to Rust enthusiasts who want to expand their knowledge of the language, particularly when it comes to powerful - but difficult to master - macros. And so the book focuses on macros, particularly the procedural kind, though we will be exploring other topics as well.

After an introduction and overview - with examples - of declarative macros, we start our procedural journey with a ‘Hello World’ example using a derive macro. In the chapters after that, we will put attribute and function-like macros into the spotlight.

Because this is an ‘advanced’ topic, I expect at least basic knowledge of the Rust language (structs, functions, tests, lifetimes…) and its surrounding ecosystem from the reader. I also assume you have Rust and Cargo installed on your computer. The book will be easier to digest if you have some professional experience as a programmer since we touch on other topics like DDD, TDD, functional programming, etc. But if those concepts do not ring a bell, there will usually be a note for each one, giving you the gist of it.

Writing a book is an exercise in humility. It reminds me of just how much I don’t know, or never thought deeply about. This is especially true when your day-to-day work as an engineer is focused on getting things working quickly to produce value.