After more than one year of development, Relm4 0.5 has finally made it across the finish line with plenty of new features and improvements! Without a doubt, version 0.5 is by far our largest release so far making Relm4 even easier, more stable and productive than before.
We can’t fit all the improvements into this post so we’ll only have a look at the most important new features added since the first beta release. Check out the full changelog for more information.
Relm4 is an idiomatic GUI library inspired by Elm and based on gtk4-rs.
We believe that GUI development should be easy, productive and delightful.
The gtk4-rs crate already provides everything you need to write modern, beautiful and cross-platform applications. Built on top of this foundation, Relm4 makes developing more idiomatic, simpler and faster and enables you to become productive in just a few hours.
The first beta release of Relm4 v0.5 brought commands as a concept from Elm, which made asynchronous code very easy to integrate. Since then, we’ve further extended async support, making it possible to use async from almost anywhere in Relm4. This fully unlocks the great potential of Rust’s async ecosystem and makes common tasks like interacting with network APIs a breeze.
In particular, asynchronous initialization of components greatly simplifies state management. Instead of immediately returning a model in an uninitialized state, you can fetch all the resources you need and eventually return a fully initialized model. On top of that, Relm4 allows you to show placeholder widgets while the model is being initialized.
Often, similar widgets and properties are used multiple times in the same application or even across different applications. With widget templates, you can define common UI elements as templates and reuse them easily.
Using the template just requires the
#[template] attribute in the macro.
You can find more details in this PR.
Sending messages from simple signal handlers has become a bit easier. Similar to the syntax of the relm crate, you can now send input messages with an arrow followed by the message.
Recently, we published Relm4 snippets as an IDE extension that provides helpful snippets for implementing Relm4’s traits. This should help you saving some time while implementing common traits so you can fully focus on coding. The extension is available on the Visual Studio Marketplace and OpenVSIX.
- Port relm4-components to 0.5
- Port the book to 0.5
- Move from custom documentation builds to docs.rs
MessageBrokerto allow communication between components at different levels
Reduceras message based alternative to
- Lots of other improvements and fixes
On the horizon
Some tools haven’t made it into this stable release but will follow soon.
- relm4-format is a tool that can format code inside the
viewmacro to address the shortcomings of
- relm4-cli is a planned client for developing Relm4 application that will make project setup, build system configuration and cross-compilation easy.
If you want to support the our team working on these projects, please consider supporting Eduardo Flores.
Where to get started
We highly appreciate feedback and contributions to Relm4. In the name of all members of the Relm4 organization I thank those who helped with this release:
- Andy Russell for his continuous effort to improve Relm4.
- Eduardo Flores for his longstanding contributions to Relm4 and his work on Relm4 snippets.
- Pentamassiv for working on Relm4 and gtk-rs to bring our docs to docs.rs.
- Maksym Shcherbak for many improvements, especially to our examples.
- Tronta for contributing many book improvements.
- Sashin Exists for implementing several useful methods for
- Everyone else who contributed or gave feedback.
- The whole gtk-rs team for providing awesome Rust bindings for GTK.