Introduction
What Masque is, what it is for, and how the pieces fit together.
Masque is a UI language and embeddable runtime for Rust applications. You describe your interface in Masque documents (.masque files). Masque compiles them to bytecode, runs them on a small stack VM inside your process, and reconciles the result into a live widget tree that a renderer draws. A Skia backend ships with the crate.
Who it is for
Masque is for Rust programs that already own a window and a frame loop and want a better way to build their interface: games, creative tools, editors, and embedded displays. It is a library you call each frame, not a framework your app moves into.
How it fits together
Your application owns all the state and logic. A Masque document is a projection of that state:
- Host state flows in. You hand the runtime values by name, and the document reads them as plain identifiers.
- Events flow out. The document calls
event("name", ...), and your registered handler decides what happens. - The document never mutates your app. It cannot reach in, so every change to your data happens in your Rust code.
Inside the runtime, a document passes through four stages, each depending only on the one before it:
| Stage | Produces |
|---|---|
| Scanner and parser | An AST |
| Compiler | Bytecode, compiled once per load |
| VM | Widget descriptors, re-run when state changes |
| Builder and reconciler | Updates to the live widget tree, applied in place |
The widget tree does layout (flexbox and grid), springs, hit-testing, and events. Only painting goes through the Surface trait, which is why the renderer can be swapped.
Where to go next
- Installation: add the crate and its native dependencies.
- Quick start: from an empty project to a hot-reloading window.
- Design principles: the rules a document can rely on.