Rust, a New Toy Opening New Possibilities

I have not had a chance to blog in a while. Aside from the usual busyness of life, and the occasional bouts of illness, I have been distracted by a few new thing I’ve been learning: Rust, Kivy and Electron. I’ll write about Kivy and Electron in a future post. And a lot of that is centred around the upcoming product launches for Amber Penguin Software. But that is again for another post.

Rust

For the longest time, systems level programming (especially operating systems) have fascinated me. As part of that, I tried to learn the languages used to implement systems namely C and C++. While today I feel more comfortable with these languages, these still scare me with either their complexity (C++), their programming tools (gdb, gcc, autoconf, and minions) and their potential to do horrible things to your system if you are not careful. And bugs can be incredibly difficult to trace down and debug. So I while I have tried to code more C and C++, I still avoid them for these reasons.

Recently I started playing around with Rust, the new language developed partially by Mozillians. After trying to write a small Docker utility in Rust, and working through some koans for Rust, I have become smitten with the language. While some of the borrowing, references and types drive me a bit crazy, overall Rust is an amazing language. It brings the best ideas from Haskell, ML, Python and C and makes them very accessible. While the language is new and evolving the community has super active and creating lots of libraries for the language on crate.io.

Also I recommend listening to the New Rustacean podcast to learn Rust as well. It is not only informative, but very well executed by host Chris Krycho. So far I’ve listened to 10 episodes, and between the podcast, the koans and simply playing with Rust, I’ve learned a lot about Rust. In fact I feel more comfortable with Rust now then I have ever felt with C or C++.

Qt Bindings for Rust or Rather the Lack Of

On the topic C++, the one thing that keeps bringing me back to liar of C++ is the amazing platform that is Qt. However one on the most infuriating thing is that (aside from the limited QML), the only effective way to program Qt apps is using C++. Sure there is PySide and PyQt, with promises that PySide will actually support modern Qt5… some day… soon…

One of the things I hoped for Rust bindings for Qt to come quickly. Unfortunately it turns out that binding to Qt and C++ inside of Rust is really, really hard. There is an interesting project to develop some Qt C bindings for Rust, but it is really early in development and I had no luck using it. It probably is easier to bring in Rust to a C++ Qt project than the other way around.

In general UIs in Rust is a weak point for the language. Then again UI libraries are not the simplest thing to get off the ground, and it might be easier to rethink how we build them in general. Again this something I can get to in a future post.