A Rust UI framework without writing Rust: GPUI apps as state machines

GPUI is the GPU-rendered Rust UI framework behind the Zed editor. This video shows a GPUI app whose whole interface is one Osprey UI machine document.

A Rust UI framework without writing Rust: GPUI apps as state machines (1:44). Captions are on; choose a chapter to jump to it.

The full write-up, with the code and its limits, is A Rust UI framework without writing Rust.

Osprey is actively evolving.

Transcript

  1. GPUI is the GPU rendered Rust UI framework behind the Zed editor. It expects you to write your interface in Rust.
  2. This casting player runs in a GPUI window, and contains no Rust of its own.
  3. Its whole interface is one data file: inputs, state machines, a view, and skins.
  4. egui redraws Rust code every frame. Slint has its own markup. Tauri puts a web front end in a web view. GPUI uses Rust views.
  5. A UI machine writes every state down and names every transition, so the interface can be checked, tested without a window, and reskinned without code.
  6. The player has four layers that run in parallel. Each has exactly one current state.
  7. Entering connecting requests cast.start, with the file and the receiver.
  8. When the TV reports playing, the layer moves itself. The document holds no code at all.
  9. The Osprey code that remains answers each request, and feeds what the TV reports back in as inputs.
  10. It never decides what the screen shows.
  11. The whole document is checked when it loads. A transition to a misspelled state is refused, with its exact JSON path.
  12. So is an initial state that does not exist.
  13. Nothing is partly applied. A cycle is reported instead of spinning, and a refused document shows its problems in place of the app.
  14. What to know first. The player runs in the GPUI host on macOS today, and the two skins without a canvas still need layout work.
  15. Build Osprey, and open the player. Osprey is actively evolving. Try it on your projects, and read the UI machines spec.