跪拜 Guibai
← Back to the summary

Seven Rust GUI Libraries, Two Questions: Who Draws and What Changes When Data Moves

cover-simple.png

I recently wanted to develop a tool for Android source code development. The features are not complex, just miscellaneous: verifying signatures, getting device signatures, checking device permissions, etc.

Although the command line can handle these problems, the operations are not intuitive and are troublesome to explain to test colleagues.

So I planned to develop a desktop application that runs on Windows and Linux.

I compared familiar desktop frameworks like CMP (Compose Multiplatform), Flutter, and also researched several Rust GUI frameworks. In the end, I chose Rust, for a simple reason: I value speed the most!

I don't need a rich set of ready-made themes and UI widgets; I only need a simple, fast, and extensible GUI library. For this small tool, I find CMP too large. It can bundle the required Java runtime with it, so colleagues don't need to install JVM separately, but I still want to save that bulk.

Then a very simple question arises: which Rust GUI library should I use?

I spent half a day researching and roughly found these: GPUI, Tauri, Egui, Iced, Slint, Dioxus, Xilem.

Each has a dedicated user base, and each has a considerable presence on forums!

When you open their example code, you find they don't even look like the same kind of program.

That is what confused me most.

After some simple sorting, I think the reason is actually clear: these libraries make different choices about how the interface should work. Clarify these choices, and choosing a library becomes much easier.

I'll use a simple log viewer app as an example.

Keeping the UI and data in sync

Every GUI library can draw a button and tell you when it is clicked. That part isn't hard.

The hard part is making the UI follow data changes. When you type "payment" in the search box, the list has to show only log entries containing "payment". Somewhere has to handle this change: when the search text changes, update the list.

Each library handles this change differently, and the traditional way tends to conflict with Rust.

The traditional tool conflict with Rust

Traditional toolkits like GTK maintain a widget tree in memory. The window holds a panel, the panel holds a search box and a list. As long as the window is open, these widgets exist.

You connect them through callbacks. Callbacks are small functions the library calls when something happens. For example: "every time the search text changes, execute this function to update the list."

In the end, parts reference each other in a web. The parent widget holds child widgets, child widgets need access to the parent, and several callbacks may all want to modify the same filter text.

Android developers should be familiar with this; it's much like the old way of building UI mainly with View.

Now think about Rust's core rule: every value has exactly one owner. Other code can borrow it, but at any time either multiple read-only borrows or one mutable borrow exist. The compiler checks these rules before the program runs, eliminating a whole class of errors.

If you directly connect widgets with crossed references, you easily hit this rule: the panel still borrows the list, the search box's callback wants to modify it; the same filter text has multiple places trying to modify it. When borrows conflict, the compiler won't let it pass. The widget tree itself doesn't violate ownership rules; the trouble is the organization of shared mutable state.

There are ways around it. For example, Rust's RefCell<T> can defer borrow checking from compile time to runtime.

The code does run, but it's too verbose to write.

If a previous borrow hasn't ended and you make a conflicting mutable borrow through borrow_mut(), it panics; using try_borrow_mut() lets you get the error and handle it.

So most developers of Rust GUI libraries avoid this traditional structure. Each team has found a design that fits Rust's ownership rules. That's why there are so many libraries.

Distinguishing these libraries with two questions

To tell them apart, ask two questions.

First question: Who draws the pixels?

Second question: What happens when data changes?

With these two questions in mind, let's look at the main options.

Egui: the simplest answer

Egui, created by Emil Ernerfeldt, uses immediate mode. The whole UI is a function that runs every time the UI needs to be drawn. You write ordinary code from top to bottom, one line per widget.

For example: if the "Clear Filter" button is clicked, clear the filter.

This single line does two things: draws the button and tells you whether it was clicked. No need to register a callback or store a button object.

All data lives in a struct you own: open files, search text, selected log level. Egui reads the data when drawing and releases borrows when done. The owner is clear, and Rust's rules stop being a problem.

For desktop apps, pair it with its official companion framework Eframe. Eframe handles opening the window, and by default draws the UI through WGPU, which handles talking to the graphics card; alternatively, a Glow backend based on OpenGL is available. The same code can also be compiled to WebAssembly and run in the browser.

"Won't it burn battery by redrawing all the time?" That's a fair question. Eframe only repaints when something happens, like mouse movement, key presses, or when you explicitly request a repaint. When idle, the overhead is minimal.

Is it good for a log viewer?

In fact, it's sufficient!

You can build a first version in an afternoon: a search box, a log-level dropdown, and a scrollable list that only constructs visible rows. Development is fast, so Egui is popular for internal tools, debug panels, and game editors.

Rerun, which Ernerfeldt co-founded, uses Egui for its data viewer, showing it can also work in real products.

Where it's less comfortable:

If that scattering starts to bother you, check out the next library.

Iced: concentrating every change in one place

Iced, initiated by Héctor Ramón, borrows from the Elm language design. Elm is known for being easy to understand. An Iced app has four parts:

  1. State: a struct holding all app state, like open files, search text, and selected log level.
  2. Message: an enum listing all possible events, like search text changed, log level selected, file load completed.
  3. Update: receives one message at a time, and is the only place responsible for changing state.
  4. View: reads state and returns a UI description; it does not modify state.

For example, when you type the letter "P" in the search box, here's what happens:

Every change in the app follows the same flow. It fits Rust's rules nicely: view is read-only, update is the only writer. Debugging is easier because every change is a message that can be logged and replayed.

This resembles Compose's recommended unidirectional data flow: state flows down, events flow up.

Time-consuming work like reading a huge log file can be wired into async flow via tasks to avoid freezing the window; blocking file reads still need to go on a background thread, not just wrapped in an async task and expected not to block. When the task completes, it sends a message, so update handles the result the same way it handles a click event.

For drawing, Iced uses WGPU; if no usable GPU is available on the machine, it can fall back to tiny-skia, which renders via CPU. Its largest real-world user is System76: its COSMIC desktop is built on libcosmic, which in turn is built on Iced. So panels, settings apps, and file managers are all Iced programs underneath.

So what's the cost?

One thing developers might not like: although the source is still updated, as of November 2026, the most recent formal release, 0.14.0, is from December 7, 2025, almost a year ago.

Tauri: handing drawing to the web

Both Egui and Iced draw the UI themselves, so every widget, text box, and chart has to be implemented in Rust. If your team already builds web interfaces, or the charts you need only exist as JavaScript libraries, throwing away that investment is a shame.

Tauri answers the drawing question differently: let the OS WebView draw the UI.

On Windows it uses WebView2, based on Edge; on macOS it uses WKWebView, which uses Safari's engine; on Linux it's WebKitGTK.

A Tauri app splits into two parts:

You may have heard of Electron, which VS Code and Slack use. It also puts a web page in a desktop window. The difference: every Electron app bundles a full Chromium, while Tauri uses the computer's engine. As a result, Tauri installers are often only a few MB, while Electron can reach 100 MB or more, depending on the app itself.

The frontend and backend communicate through commands.

A command is an ordinary Rust function marked with Tauri-specific attributes. In our log viewer, it could be a search function that takes search text and returns matching rows. The web page calls invoke, passing the command name and search text. These calls typically serialize arguments and results as JSON, Tauri runs the corresponding Rust code, and returns the result to the web page.

This split suits a log viewer well: Rust scans large files, and the web page only receives the small number of logs it needs. If logs are being written continuously and need live updates, Tauri also provides channels that stream data to the web page in sequence.

Tauri 2 has been stable since October 2024, adding the ability to support iOS and Android in the same project. It also introduced capabilities, which restrict which core and plugin commands a window or WebView can use, and scope access for commands that support it. When configured correctly, you can limit malicious web code from calling things like file access. However, custom commands registered via invoke_handler are, by default, callable by all windows and WebViews in the app, and need additional configuration to be included in permission restrictions.

Trade-offs:

GPUI: writing a library because browsers aren't fast enough

GPUI comes from the Zed editor team.

Zed is one of the more notable Rust-based editors these days.

The founders, including Nathan Sobo, previously worked on GitHub's Atom editor. Atom was based on Electron; in fact, Electron was originally created for Atom. After years of trying to speed up Atom, they concluded that an editor built on a browser engine is ultimately limited by that engine.

Great minds think alike. I also care about the trade-offs in JVM-based apps regarding startup, memory, and garbage collection, and I also believe JVM-based apps are ultimately limited by the JVM.

So when building Zed, they wrote their own GUI library, designed more like a video game than a web page. The goal is up to 120 frames per second, giving each frame just over 8 milliseconds of preparation time. Drawing goes straight to the graphics card: Metal on macOS, DirectX 11 on Windows; per the materials I referenced, WGPU on Linux.

So how does its data flow work?

It combines two ideas:

For a log viewer, the most critical feature is the uniform list.

If every row is the same height, the list only needs to measure one row to figure out positions of the others, and draw only the part that fits on screen. By only laying out and drawing visible rows, scrolling through 2 million log lines can cost nearly as much as browsing 50 lines. The cost of reading, indexing, and filtering the whole file still has to be counted separately.

The problem:

GPUI serves Zed first, and other users come second. Its API changes with Zed's needs, and there's sparse documentation; often you have to read Zed's source directly. Screen-reader support is still catching up to traditional toolkits.

A company called Longbridge maintains gpui-kit, offering 70+ ready-made widgets, which helps a lot.

In my view, GPUI is well suited for tools that care about drawing speed, but it's still changing rapidly, and you'll have to follow another team's roadmap. As for whether it's the fastest of these, that needs to be measured in the same scenarios.

Others

One thing worth noting: these projects share many low-level components.

Many libraries use Winit for windows, WGPU for drawing, Taffy for layout, and AccessKit to describe widgets to screen readers. When one shared library improves, it can benefit several GUI libraries at once.

What to choose for a log viewer

Based on the comparison above, here's how I'd choose:

These libraries don't have a single ranking from good to bad. They simply give different answers to the same two questions: who draws the pixels, and how does the UI follow data changes? Answer these two questions for your own project first, and which library to pick becomes largely clear.

And me

As for my tool for Android source development, I ended up picking GPUI. Because for me, speed is the most important metric!

Comments

Top 1 from juejin.cn, machine-translated. The original thread is authoritative.

Fritz

makePad development speed is also quite fast.