O'Reilly logo

The Rust Programming Language by Carol Nichols, Steve Klabnik

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required