Surveying Rust GUI Crates

2021-02-21 // 5 minutes

Introduction

For my project beholder, I was hitting the point where it made sense to add a desktop GUI. Briefly, that project is aimed to - among other things - make keeping color schemes across different apps and OSes consistent. As such, it made sense to have a visual representation of a color scheme earlier in the project. While I have done some desktop GUI work in C++, I had not yet had a reason to do so in Rust. Therefore, I thought it would be a good idea to survey the landscape of what crates are available and spend some time with each one to determine which would be the best fit for me and my project.

With that big of prolog out of the way, let's get to it. The best place to start any survey of crates in Rust is to use one of the "Are We X Yet?" sites. For GUIs, the best place to start is https://www.areweguiyet.com/.

Mention/thank the other blogs you used as sources.

List out the sources you used to determine which crates to survey.

Requirements

Here's a brief list of requirements I'll be referencing as I test out each crate. I wouldn't consider this a list of requirements for an ideal GUI crate - that would be a separate effort - so much as what I need for the project I have in mind.

  1. Checklist: This is mostly for gaining familiarity with the crate and figuring out how it handles its event lifecycles.
  2. Color Picker: Since my project has a large themeing component, I want users to be able to select/modify their colors within the app.
  3. File Management: I need an intuitive way to manage files, so if the GUI crate doesn't support that then I would need to move on.
  4. Tabs: This could be tabs or pages or any other way of handling navigation.
  5. Aesthetics: Can I make it pretty without too much pain? I realize this is subjective, but it's something I value.
  6. Performance: Not sure how I will measure this yet.
  7. Cross-Platform: I'm personally building the theme management project to work across OSX and Windows. But I want it to support all popular platforms, so that needs to be something I consider.

Azul

https://azul.rs/

Basalt

https://github.com/austinj235/basalt

Conrod

https://github.com/pistondevelopers/conrod

This one compiles from the jump, sweet!

Druid

https://github.com/linebender/druid

More compilation errors without matching GitHub issues. It would be time to report the issue and move on, but I found a working example from https://linebender.org/druid/get_started.html. I'm concerned that the README has a non-working example, but for a pre v1.0 project I'm slightly less annoyed.

λ cargo run
   Compiling druid-test v0.1.0 (D:\Projects\rust-gui-survey\druid-test)
error[E0277]: expected a `FnOnce<()>` closure, found `impl druid::Widget`
   --> src\main.rs:17:39
    |
17  |     let main_window = WindowDesc::new(ui_builder());
    |                                       ^^^^^^^^^^^^ expected an `FnOnce<()>` closure, found `impl druid::Widget`
    |
   ::: C:\Users\JR\.cargo\registry\src\github.com-1ecc6299db9ec823\druid-0.7.0\src\app.rs:347:28
    |
347 |         F: FnOnce() -> W + 'static,
    |                            ------- required by this bound in `WindowDesc::::new`
    |
    = help: the trait `FnOnce<()>` is not implemented for `impl druid::Widget`
    = note: wrap the `impl druid::Widget` in a closure with no arguments: `|| { /* code */ }`

error[E0599]: no method named `use_env_tracing` found for struct `AppLauncher<_>` in the current scope
  --> src\main.rs:20:10
   |
20 |         .use_env_tracing()
   |          ^^^^^^^^^^^^^^^ method not found in `AppLauncher<_>`

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0277, E0599.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `druid-test`

To learn more, run the command again with --verbose.

FLTK

https://github.com/MoAlyousef/fltk-rs

The sample code compiles! This probably shouldn't be a source of major excitment at this point, but here we are all the same.

GTK

https://gtk-rs.org/

Installation instructions led me to here, which had instructions for installing GTK through MSYS2. I've been down this road before. Hard pass. There's no need to evaluate this any further.

Iced

https://github.com/hecrj/iced

Compiled, but not a copy and paste affair from the examples directory into a fresh project. This is workable, just annoying.

Imgui

https://github.com/imgui-rs/imgui-rs

Compiled. It's a wrapper for the C++ library DearImgui. I'm a fan of the base library, but less fond of wrapper libraries - generally. Still, it's worth investing time into.

KAS

https://github.com/kas-gui/kas

Examples directory isn't easy to use. Got the hello example to compile after guessing at some compilation solutions. But found even more compiler errors trying to build the splitter example.

Neutrino

https://github.com/alexislozano/neutrino

Relies on webkit and is abandoned by the maintainer without anyone as of yet taking over the project.

OrbTk

https://github.com/redox-os/orbtk

Compiles. Yay!

Relm

https://github.com/antoyo/relm

Failed to compile. Relied on GTK anyways. Next!

Sciter

https://github.com/sciter-sdk/rust-sciter

The project does look good for those who are okay with a web based renderer. However, I already have enough projects to choose from that don't.