Exploration towards building Ica (a GUI code editor) has continued in October. Having figured out a rendering strategy at the end of last month, the next step has been to design a framework/engine that sits atop the rendering layer and deals in terms of element trees, event listeners, and effect observers.
At this level we don’t have to think about how primitives are drawn to the screen, nor how to create a window and receive events from user interactions. Our high level responsibility is to define the lifecycle for abstract elements and figure out how state is managed. What this boils down to is an overwhelming amount of pieces that have to fit nicely together.
No doubt writing a GUI system is difficult and complex. Writing a GUI system in Rust also adds another degree of complexity as these systems tend to build upon mutable, bi-directional trees which are non-trivial to implement with the restrictions of Rust’s borrow checker.
Thankfully there are many GUI frameworks being developed in the Rust ecosystem. Raph Levien has catalogued many of them with articles that break down their architectures and tradeoffs, such as Advice For the Next Dozen Rust GUIs. As I am going down the path of a native (i.e: non-electron), retained/hybrid mode GUI that isn’t based on the Elm architecture, the GUIs I’ve been looking at this month have been Xilem, Flutter, and GPUI.