Gui development in rust


is it possible to develop gui using html css and rust since rust support web rendering engine


Technically yest - pobably the easies way by electron If you want to use servo for this, it would be difficult - servo is rendering engine, but it in general doesn’t include a way to get back user input and handle it - its ment to be handled by JavaScript. I don’t know about any succesfull attempt to use servo as GUI library. In general GUI in Rust is difficult topic, I personally would recommend delivering GUI via pure html/css/js, and communicating with Rust logic via web sockets. After all this may be converted into desktop application via electron.


I should note that users hate Electron apps for a good reason - you run browser copies for just a couple widgets. So if you do not despise your users, forcing them to buy more RAM for no reason - I would recommend to use proper frameworks:


Indeed there’s a whole homepage about Rust and GUI devellopment. Maybe you should check it out.
In addition, there is a big topic about this, already.

Generally, as @XVilka mentioned there are a number of creates/frameworks for GUI development in Rust, already. None of them seams matrure, however.

The biggest problem is that most GUI-frameworks are heavily OOP, relying on inheritance which is hard to rebuilt in Rust and very unidiomatic.
Moreover, often pointer-cycles are used (parents have array of children; children have pointer to their parent) which is generally bad but worse in Rust (think of doubbly-linked lists :wink:).


so gtk+ will be good option since it is written in c language


I was going to link to the same mega-thread. But here’s a list of the options from that thread which I feel are worth mentioning (again):

web-view provides the least friction, and is an excellent alternative to shipping all of Chromium+nodeJS (e.g. Electron).

azul and skryn are both based on webrender, but they are both in the very early stages of development.

imgui and nuklear are ideal for adding a GUI to games (since you’re most likely already dealing directly with the GPU anyway).