/tlborm

The Little Book of Rust Macros (updated fork)

Primary LanguageHTMLMIT LicenseMIT

The Little Book of Rust Macros

Note: This is a continuation of Daniel Keep's Book which has not been updated since the early summer of 2016, adapted to make use of mdBook.

View the rendered version here and the repository here.

A chinese version of this book can be found here.

This book is an attempt to distill the Rust community's collective knowledge of Rust macros, the Macros by Example ones as well as procedural macros(WIP). As such, both additions (in the form of pull requests) and requests (in the form of issues) are very much welcome. If something's unclear, opens up questions or is not understandable as written down, fear not to make an issue asking for clarification. The goal is for this book to become the best learning resource possible.

The original Little Book of Rust Macros has helped me immensely with understanding Macros by Example style macros while I was still learning the language. Unfortunately, the original book hasn't been updated since April of 2016, while the Rust language as well as its macro-system keeps evolving. Which is why I took up the task to update the book and keep it updated as well as I can while also adding newfound things to it. In hopes that it will help out all the fresh faces coming to Rust understanding its macro systems, a part of the language a people tend to have trouble with.

This book expects you to have basic knowledge of Rust, it will not explain language features or constructs that are irrelevant to macros. No prior knowledge of macros is assumed. Having read and understood the first seven chapters of the Rust Book is a must, though having read the majority of the book is recommended.

Thanks

A big thank you to Daniel Keep for the original work as well as all the contributors that added to the original which can be found here.

License

This work inherits the licenses of the original, hence it is licensed under both the Creative Commons Attribution-ShareAlike 4.0 International License and the MIT license.