10 Macros and the outside world

This chapter covers

  • Using a single library to expose multiple macros
  • Adding or disabling functionality with features
  • Using attributes for control over what code will be generated
  • Documenting and publishing a macro library
  • Moving on to explore interesting macro subjects beyond this book

In previous chapters, we have often made excuses for taking shortcuts, explaining how “production-grade” macros would do things better or differently. In this, our last, chapter, we will create a macro for making available YAML config that tries to do everything right. While its functionality will be very limited, it will have proper testing, error handling, documentation, and the like, making it (almost) ready for use by ...

Get Write Powerful Rust Macros now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.