A month with ICED.
I had a little pet project GUI I wanted to do with Rust and wen t looking for a GUI toolkit for the task and decided ICED was worth a try. I’d previously done a larger project with Rust and GTK4 and found the pairing of GTK and Rust clumsy.
So how did I go with ICED.
The Good
Not surprisingly ICED and Rust fit together very well. ICED is written in Rust and uses the Rust idioms throughout, so if you are reasonably competent in Rust and I am no expert, you should have little trouble using ICED.
Like with most things Rust, if your ICED program builds, then it probably works as expected. There is still the opportunity for out of bounds panics, but not much else seems to go wrong.
The learning curve
The examples found at, iced/examples at master · iced-rs/iced · GitHub, are good and quite comprehensive. They can be a little hard to follow at first, because they contain no comments and this is one place where I feel comments could be really helpful.
The other thing about ICED is the model that it follows is intrinsically very simple and easy to get to terms with.
ICED is however very different from all the other GUI toolkits I have used over 30 years, from Smalltalk V through Visual Basic, Delphi, Java Swing * SWT and GTK. ICED is a retained mode GUI, but not as you know it.
Widgets are not ‘owned’ by the application and do not hold any state that can be accessed by the program. In a traditional GUI you would construct a window or part thereof when the window is constructed and query and update those widgets as required. The GUI toolkit paints them on the display.
ICED is different. At each interaction, the application receives a “Message” and then updates it’s state as required and constructs the whole widget stack and returns it to ICED. The application needs to manage all the state it is interested in, such as, if a checkbox is checked or not. Some widgets, that have complex states, such as TextEditor, break this pattern and directly update a stateful “object” that the application needs to retain.
ICED is new
ICED is still very new and very much a work in progress. There is a large collection of widgets, which should be suitable for most purposes, but there are still things missing. The part I found most lacking at this time was the handling of input Focus. The UI can’t really be used from the keyboard alone as moving Focus about using the keyboard (or programatically) is not really possible yet.
Scaling
ICED has, like most GUI toolkits, an event loop that controls the interactions, this has two main entry points to your application, fn update(&mut self, message: Message)
which passed messages in and fn view(&self) -> Element<Message>
which is called to get the interface to display.
As the interface grows, the number of different message types needed to be handled grows accordingly and there is no obvious or straight foward way to decompose the logic, especially as multiple windows and/or views and panels are added.
As I said earlier, ICED is new, and multi-window support has recently been added, but how to neatly decompose your application to keep it maintainable is something to consider, before embarking on a large project with ICED.
Summary
I liked using ICED and found it easy to learn and predictable in use. If you are starting out with ICED; make good use of the examples and the community, who are both helpful and knowledgable.