3 ms·
From what I've seen, most frontend Rust development is focusing on replacing C/C++/C# frontends, not necessarily for websites or even really desktop application
by smoldesu 6y ago
From what I've seen, most frontend Rust development is focusing on replacing C/C++/C# frontends, not necessarily for websites or even really desktop applications.
With that being said, I have written a few GTK+ applets in Rust, and I gotta say that it's not as bad as it sounds or looks. The current GTK crate supports Glade, meaning that you don't have to actually write your frontend in Rust, rather building it in a different program, exporting it as glorified XML and binding the intractables to different buttons and fields. A hello world-styled GTK demo is only a few lines, and of course you get a wickedly performant binary out of the process too (mine used 4mb of memory, which could have been further optimized).
- moritzwarhier 6y agoThanks for the informative reply!
- capableweb 6y agoAs someone with limited experience, how do you deal with animations and such in GTK/Glade? Took a look at the Glade website (https://glade.gnome.org/ https://glade.gnome.org/) and doesn't seem mentioned. In fact, I cannot even find a list of supported features.
- estebank 6y ago(Disclaimer: I have no idea what I'm talking about) I wouldn't be surprised if you could/had to do something similar to this sprite handling example[1], where instead of updating the sprite's location you update widgets' attributes. This would be a "manual" process, but it should work (if repainting widgets is fast enough). [1]: https://github.com/steshaw/gtk-examples/blob/master/ch13.sprites.animation/defender/animate.c#L304 https://github.com/steshaw/gtk-examples/blob/master/ch13.spr...
- smoldesu 6y agoAnimation is handled by the compositor I'm pretty sure. Since different Linux desktops have different performance requirements, some will opt-in to using more fancy animations, whereas less powerful ones will disable them. For everything else, you'd probably need to use some bespoke activators to achieve the effect you want. Not terribly hard to spin up, but it's definitely less simple than languages designed for frontend development.
- capableweb 6y ago> Animation is handled by the compositor I'm pretty sure. Since different Linux desktops have different performance requirements, some will opt-in to using more fancy animations, whereas less powerful ones will disable them. I... don't understand what this means. Let's say in GTK/Glade I want a Button that when you click on it, it moves from the bottom-left corner to the top-right corner. How do I archive this in that GUI builder or even with the XML spec?
- smoldesu 6y agoI haven't done anything like this myself, but you can directly manipulate the location of UI elements in realtime. Failing all else, Rust is at least low enough level to impliment a frame-by-frame redraw... but that would be a very yucky way to do that.
- reader_mode 6y agoReplacing C# with Rust for front-end sounds equally ridiculous. C# is much higher level and ergonomic to use for this, the tooling alone is lightyears ahead for the job - compile times/debugging for GUI iteration alone. I can understand using rust for front-end to slap some simple gui on top of some complex lib and allows a lot of reuse (although I would still prefer GUI using rust through an interface from higher level like FFI/IPC).