---
title: "Porting a cross-platform GUI application to Rust"
description: "Firefox's crash reporter was rewritten in Rust, replacing three separate native GUI implementations (Win32, GTK, macOS) and their C++/Objective-C glue, which had no test suite, with a small custom UI abstraction."
url: "https://swe.quest/articles/porting-a-cross-platform-gui-application-to-rust-ea27ecd8be540e13"
canonical: "https://hacks.mozilla.org/2024/04/porting-a-cross-platform-gui-application-to-rust/"
source: "Mozilla Hacks"
published: "2024-04-23"
difficulty: "medium"
kind: "Case study"
reading_minutes: 20
tags: ["rust","frontend","refactoring","testing"]
---

# Porting a cross-platform GUI application to Rust

A post on [Mozilla Hacks](https://swe.quest/sources/mozilla-hacks.md), published 2024-04-23, 20 min read, Case study. Original: [https://hacks.mozilla.org/2024/04/porting-a-cross-platform-gui-application-to-rust/](https://hacks.mozilla.org/2024/04/porting-a-cross-platform-gui-application-to-rust/)

## Summary

Firefox's crash reporter was rewritten in Rust, replacing three separate native GUI implementations (Win32, GTK, macOS) and their C++/Objective-C glue, which had no test suite, with a small custom UI abstraction. The reporter must run independently of Firefox code and avoid large dependencies, so third-party GUI crates were rejected. Instead a declarative UI model borrowed from GTK concepts is built with an ElementBuilder and a ui! macro, wired up through simple data-binding primitives (events, synchronized values, on-demand values) in an MVVM-like style. Each platform backend implements just run\_loop and invoke, and a virtual test backend lets the UI be tested.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Rust](https://swe.quest/tags/rust.md) (Languages)
- [Frontend](https://swe.quest/tags/frontend.md) (Web & mobile)
- [Refactoring & migrations](https://swe.quest/tags/refactoring.md) (Engineering practices)
- [Testing](https://swe.quest/tags/testing.md) (Engineering practices)

## Prerequisites

- Rust basics ([easy posts on Rust](https://swe.quest/tags/rust.md?difficulty=easy))
- Rust macros ([easy posts on Rust](https://swe.quest/tags/rust.md?difficulty=easy))
- native GUI toolkits

## Keywords

Firefox, crash reporter, GTK, Win32, Cocoa, MVVM

## Related posts

- [Why the big rewrite?](https://swe.quest/articles/why-the-big-rewrite-ec307a4c7f73f459.md): Zed · 2024-01-23 · Easy · 21 min read · Rust, Frontend, Refactoring & migrations, Developer tools
  Zed rewrote its Rust UI framework from GPUI 1 to GPUI 2 because the original design blocked fast UI work: a Flutter-style constraints-down/sizes-up layout model, styles split between Rust element code and TypeScript-generated JSON "themes" loaded at runtime, model code entangled with presentation (a legacy of an early Electron/JSON architecture), and weakly typed geometry (raw f32s and usizes).
- [Zed Weekly: #25](https://swe.quest/articles/zed-weekly-25-cd3a5f41d4f0b187.md): Zed · 2023-11-03 · Medium · 6 min read · Rust, Frontend, Refactoring & migrations, Developer tools
  Zed is rewriting its UI framework as GPUI 2 and porting the whole editor onto it before open-sourcing, trading feature work for better ergonomics while keeping GPUI 1's performance.
- [Autogenerating Rust-JS bindings with UniFFI](https://swe.quest/articles/autogenerating-rust-js-bindings-with-uniffi-bb58b4f2efeb71af.md): Mozilla Hacks · 2023-08-08 · Medium · 5 min read · Rust, JavaScript, Browsers, Concurrency
  Mozilla extended UniFFI, its Rust library for auto-generating foreign-language bindings, to emit JavaScript bindings for Firefox Desktop starting in Firefox 105, replacing error-prone hand-written wrappers that undermined Rust's memory safety.
- [Zed Weekly: #27](https://swe.quest/articles/zed-weekly-27-be3a7010da4c60e0.md): Zed · 2023-11-24 · Medium · 4 min read · Rust, Frontend, Developer tools
  GPUI, Zed's UI framework, settled on its core view traits: \`Render\` builds a view from a mutable reference each frame, \`RenderOnce\` builds composable elements by consuming them, and \`#\[derive(IntoElement)\]\` lets custom components be passed straight to \`div().child(...)\`. gpui2 now sizes UI in \`rem\` units tied to a new \`ui\_font\_size\` setting (default 16px, on a 4px grid), so the interface scales independently of buffer font size, though sub-pixel sizes remain unresolved.
- [This Week at Zed Industries: #16](https://swe.quest/articles/this-week-at-zed-industries-16-c2caea343c027dbd.md): Zed · 2023-08-18 · Medium · 13 min read · Rust, Frontend, Type systems, Developer tools
  Zed has started using its new channels feature internally, where members can message, talk, share screens and co-edit projects, and plans to use it to stream development and host office hours once the editor is open-sourced.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
