9 Writing an infrastructure DSL

This chapter covers

  • Grasping the ideas behind Infrastructure as Code
  • Parsing a custom syntax with structs and keywords
  • Thinking about parsing tradeoffs
  • Avoiding duplication by combining procedural and declarative macros
  • Calling asynchronous functions in a macro and creating cloud resources

Most of the macros we have created thus far work within Rust, generating new functions, adding methods to enums, etc. But we also know macros can do more than that. For example, they allow you to generate compile-time checked HTML (Yew), or they create infrastructure for your code based on annotations (Shuttle).

This chapter features a macro that boldly goes beyond the confines of Rust and creates infrastructure in ...

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.