Re:Rust in 2018: easier to use
by vhakulinen on Sunday January 14, 2018 @04:46AM
(#16143518)
Writing GUI with rust is totally possible: http://gtk-rs.org/
[ Parent
| on HN ]
It is possible, but far from productive, which I learned exactly by trying to use Gtk-rs to port an old basic Gtkmm demo, that I used for a C/C++ Users Journal article.
Wasn't Rust invented to write a GUI? A webbrowser can be regarded as a kind of GUI.
There aren't any good GUI libraries available for Rust at the moment. GUI libraries are huge and take an enormous amount of work to get right. It's typically only the most popular three or four languages at any given point in time that have satisfactory GUI libraries. Rust has the additional burden that it is far from trivial to wrap Gtk, Qt or other C/C++ toolkits in a safe manner.
Didn't Mozilla write a GUI library before they wrote Firefox? It would strike me as odd if they didn't.
There is no mature GUI library for Rust that I'm aware of. I believe the servo project is focused on writing a browser rendering engine, not a browser GUI. It certainly has not so far yielded a GUI toolkit that can be straightforwardly used in other projects.
No, it was invented to write a generic (web) rendering engine.
So, even if we consider a web app as a GUI, Rust wasn't invented for writing that (you still use CSS, HTML, JS etc for that part). It was invented for writing the backend for that UI.
In other words, Rust is not GTK (a UI library), it's C (the language the UI library itself is written in).
Ok what is the GUI of Firefox written in/using?
Until recently-ish something called XUL, a markup language for UI (similar to HTML, or even better XAML). Not sure if they've moved on since.
Rust was invented for low-level parsing/rendering code. The high level GUI in Firefox is not implemented in Rust for all I know.
Yes but "possible" and "pleasant" are very different :(
gtk-rs needs a macro package to parse a HTML or a XML snippet and generate GUI, with embedded rust code in appropriate place. Look at Yew for example: https://users.rust-lang.org/t/yew-a-framework-for-client-sid... .