Preface
local graph
Chapter 1 — Preface
Section titled “Chapter 1 — Preface”Preface
Section titled “Preface”You are your own forerunner, and the towers you have built are but the foundation of your giant-self. And that self too shall be a foundation.
— Kahlil Gibran
Like many developers, I have grown fond of the Rust language—not per se because of the language’s great performance characteristics but because of its sound fundamentals, powerful type system, and excellent tooling. And while it may be a hard language to learn, there are a lot of guides available for getting started, including many books, tutorials, and videos. When it came to procedural macros, I felt a bit in the dark, though. Introductions and tutorials on that subject were short or partial. Peculiar, considering the vast number of libraries that were using macros for all kinds of amazing functionality!
So, after a lot of toying around with macros, I thought I could bring together what I had learned along the way, turning it into a book—a book that would take its reader on a journey from the simplest example of a procedural macro to things that could, almost, find a place in real applications. I started writing. After creating a raw draft of about a hundred pages, I contacted Manning to ask whether they were interested. They too thought that this subject was worthy of a book, and they wanted to give me a chance to write it for them. That meant more writing, the exploration of additional ideas and suggestions, and rewrites after feedback, all of which has led to the book you see before you now.
Macros have their challenges: they can be hard to write and hard to read, especially for a newcomer. They also add complexity, as well as dreaded compilation time. But time and time again, Rust developers have found ways in which macros prove their worth.
about the cover illustration
Section titled “about the cover illustration”The figure on the cover of Write Powerful Rust Macros is captioned “Devineresse de Krasnoyarsk,” or “Soothsayer of Krasnoyarsk,” taken from a collection by Jacques Grasset de Saint-Sauveur, published in 1797. The illustration is finely drawn and colored by hand.
In those days, it was easy to identify where people lived and what their trade or station in life was just by their dress. Manning celebrates the inventiveness and initiative of the computer business with book covers based on the rich diversity of regional culture centuries ago, brought back to life by pictures from collections such as this one.
xviii