Skip to Main Content
The Rust Programming Language
book

The Rust Programming Language

by Steve Klabnik, Carol Nichols
July 2018
Intermediate to advanced content levelIntermediate to advanced
552 pages
13h 50m
English
No Starch Press
Content preview from The Rust Programming Language

DMACROS

image

We’ve used macros like println! throughout this book but haven’t fully explored what a macro is and how it works. This appendix explains macros as follows:

  • What macros are and how they differ from functions
  • How to define a declarative macro to do metaprogramming
  • How to define a procedural macro to create custom derive traits

We’re covering the details of macros in an appendix because they’re still evolving in Rust. Macros have changed and, in the near future, will change at a quicker rate than the rest of the language and standard library since Rust 1.0, so this section is more likely to become out-of-date than the rest of the book. ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Programming WebAssembly with Rust

Programming WebAssembly with Rust

Kevin Hoffman
Programming Rust

Programming Rust

Jim Blandy, Jason Orendorff
The Rust Programming Language, 2nd Edition

The Rust Programming Language, 2nd Edition

Steve Klabnik, Carol Nichols

Publisher Resources

ISBN: 9781492067665Errata Page