Note 557

Christian Kruse

I’ve been trying to grasp how to structure a Rust GTK application for some time now. The basic grasp was to use Rc<RefCell<_>> to pass around application state. That seemed error-prone and cumbersome to me, and I was looking how other applications do it.

Today I stumbled upon an approach using message passing, which looks pretty promising to me. Have a look at this blogpost and this github repository. It seems to make handling state much more easy and less error-prone.

I think I will try to implement this approach in a beginner project.

What others had to say…

Jeena wrote at https://jeena.net/notes/1232

Interesting, it quite reminds me of Qt's Signals & Slots https://doc.qt.io/qt-5/signalsandslots.html make UI applications with C++ so much easier to write.