Maud is a compile-time HTML template engine for Rust that uses the html! macro to transform markup directly into specialized Rust code.
What is Maud?
Maud is an HTML template engine implemented as a Rust macro. It takes template markup written inside the html! macro and compiles it to Rust code at build time, producing the final HTML output. The engine runs entirely on the Rust toolchain, with no runtime template interpreter. The project is maintained by lambda-fairy and distributed as the maud crate on crates.io.
Key Features
- Compile-time macro — The
html!macro converts templates into Rust code during compilation, so templates are checked and optimized as part of the build. - Type safety — Because templates become typed Rust code, mismatched attributes and invalid nesting are caught by the compiler.
- High performance — The compiled output is specialized Rust code, avoiding runtime parsing and interpretation overhead.
- Simple deployment — There is no separate template runtime or engine to ship; the binary already contains the rendered output logic.
- Crate distribution — Maud is published on crates.io and documented on docs.rs, with an official book at maud.lambda.xyz.
- CI-tested — The repository runs continuous integration via GitHub Actions, with badges indicating passing tests and a recent crate version.
Who is Maud for?
Maud is for Rust developers who need to generate HTML from within their applications. It fits projects that value compile-time checking and minimal runtime dependencies.
- Rust web developers — integrate type-safe, fast server-side templates into their web services without adding a scripting language.
- Library authors — embed HTML generation inside Rust libraries while keeping the dependency tree small.
- Teams that prioritize correctness — rely on the Rust compiler to catch template errors before deployment.
What can you do with Maud?
- Server-side rendering — generate complete HTML pages for Rust web applications.
- Email templates — produce HTML email bodies programmatically from Rust code.
- Reusable view components — compose functions that return
html!fragments and reuse them across pages. - Static site generation — build a generator that writes out static HTML files.
How does Maud work?
Write markup inside the html! macro. At compile time, the macro parses the markup and generates Rust code that constructs the HTML string when executed. The resulting code is type-checked and optimized by the Rust compiler, so templates are validated before the program runs.
Pricing
Maud is open-source and free to use. It is distributed through crates.io and can be added to any Cargo project as a dependency.
Alternatives
Other Rust template engines include Askama, which also compiles templates at build time using a Jinja-like syntax, and Tera, which is a runtime template engine with a larger collection of built-in filters and functions.
FAQ
Is Maud free?
Yes, Maud is open-source and can be added to your project from crates.io at no cost.
How does Maud work?
Maud is a proc macro that parses template markup at compile time and emits plain Rust code. That code builds the HTML string when the program runs, so no runtime template interpreter is needed.
Is Maud type-safe?
Yes, because templates become Rust code, the compiler validates the structure, attributes, and nesting. This catches many errors before the program is even launched.
Does Maud have documentation?
The official book is available at maud.lambda.xyz, and the generated API reference is hosted on docs.rs for the maud crate.
Where can I get Maud?
It is published on crates.io and can be added to a Cargo.toml file. The source code is on GitHub at lambda-fairy/maud.








