TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Why is building a UI in Rust so hard?

111 pointsby osenerabout 2 years ago

22 comments

ttiuraniabout 2 years ago
Raph Levien, who&#x27;s behind Druid and Xilem (<a href="https:&#x2F;&#x2F;raphlinus.github.io&#x2F;rust&#x2F;gui&#x2F;2022&#x2F;05&#x2F;07&#x2F;ui-architecture.html" rel="nofollow">https:&#x2F;&#x2F;raphlinus.github.io&#x2F;rust&#x2F;gui&#x2F;2022&#x2F;05&#x2F;07&#x2F;ui-architect...</a>) UI frameworks, recently gave a talk about very similar issues. Slides here:<p><a href="https:&#x2F;&#x2F;docs.google.com&#x2F;presentation&#x2F;d&#x2F;1P8Su5mZSYkfZ1A9mPAaKag-vtXmVD8nUBD7Ym-pfwJM&#x2F;edit?usp=sharing" rel="nofollow">https:&#x2F;&#x2F;docs.google.com&#x2F;presentation&#x2F;d&#x2F;1P8Su5mZSYkfZ1A9mPAaK...</a>
评论 #35208077 未加载
评论 #35209399 未加载
satvikpendemabout 2 years ago
I gave up and started using Flutter with flutter_rust_bridge for business logic. I&#x27;m convinced that UI development from scratch simply cannot happen without a large company backing the project, giving it time and money. Flutter took over ten years and likely millions of dollars. HTML, CSS, and JS &#x2F; TS? Likely billions.<p>This is because simply building the UI toolkit itself is usually not a prime motivator for a startup, they want to work on their differentiating features, not on reinventing the wheel. Of course, if the startup is a text editor or other such UI heavy app, then it may make sense to reinvent the UI wheel. Figma showed this successfully, and perhaps Zed and Warp might, too.
评论 #35208540 未加载
pjmlpabout 2 years ago
Recommended reading for everyone that doesn&#x27;t get how traits are just yet another kind of OOP.<p>&quot;Component Software: Beyond Object-Oriented Programming&quot;<p><a href="https:&#x2F;&#x2F;www.amazon.de&#x2F;-&#x2F;en&#x2F;Clemens-Szyperski&#x2F;dp&#x2F;0201745720" rel="nofollow">https:&#x2F;&#x2F;www.amazon.de&#x2F;-&#x2F;en&#x2F;Clemens-Szyperski&#x2F;dp&#x2F;0201745720</a><p>&quot;Authoring ActiveX with VB 6&quot;<p><a href="https:&#x2F;&#x2F;learn.microsoft.com&#x2F;en-us&#x2F;previous-versions&#x2F;visualstudio&#x2F;visual-basic-6&#x2F;aa262304(v=vs.60)" rel="nofollow">https:&#x2F;&#x2F;learn.microsoft.com&#x2F;en-us&#x2F;previous-versions&#x2F;visualst...</a><p>&quot;Traits - Composable Units of Behavior&quot;<p><a href="https:&#x2F;&#x2F;scg.unibe.ch&#x2F;research&#x2F;traits" rel="nofollow">https:&#x2F;&#x2F;scg.unibe.ch&#x2F;research&#x2F;traits</a><p>&quot;Working with Protocols&quot;<p><a href="https:&#x2F;&#x2F;developer.apple.com&#x2F;library&#x2F;archive&#x2F;documentation&#x2F;Cocoa&#x2F;Conceptual&#x2F;ProgrammingWithObjectiveC&#x2F;WorkingwithProtocols&#x2F;WorkingwithProtocols.html" rel="nofollow">https:&#x2F;&#x2F;developer.apple.com&#x2F;library&#x2F;archive&#x2F;documentation&#x2F;Co...</a>
评论 #35208143 未加载
评论 #35208078 未加载
dgb23about 2 years ago
I haven&#x27;t done any UI work in Rust, have used the language sparingly on the side.<p>But while reading the article, I was thinking &quot;You&#x27;re modelling the tree wrong! The memory layout doesn&#x27;t need to know that it is a tree!&quot; - gladly we came to the same conclusion.<p>The funny thing with this pattern is that Rust is much more loose when it comes to modelling with hashmaps and vectors. You are essentially creating user-space references and maintaining them with your own logic.<p>You&#x27;re basically circumventing the borrow checker, but also a lot of other problems as you encapsulate the maintenance of these references within your tree &#x2F; graph data structure.<p>But in a sense it&#x27;s cheating! When you give me a key to a hashmap, do _I_ know whether the thing is there?
评论 #35207848 未加载
评论 #35209962 未加载
评论 #35207870 未加载
评论 #35207533 未加载
MrPatanabout 2 years ago
Maybe it turns out web and electron UIs took over the world because web technologies are just a better way of building UIs, and everybody who tries them in earnest realizes it.<p>How about &quot;Every GUI toolkit out there trying to avoid using web tech is going to end up implementing a half-baked implementation of CSS&quot;, to coin a phrase.
评论 #35207621 未加载
评论 #35207618 未加载
评论 #35207806 未加载
评论 #35207554 未加载
评论 #35207488 未加载
评论 #35207550 未加载
评论 #35207506 未加载
BiteCode_devabout 2 years ago
Building an UI is hard, even with language with good support for it. Web ui are hard. Python ui are hard.
评论 #35207381 未加载
评论 #35209422 未加载
评论 #35207249 未加载
评论 #35207150 未加载
noelwelshabout 2 years ago
I&#x27;m confused by the discussion of OO. Just use an enum, aka algebraic data type, if you want control over the data. You can build an extension point into the ADT for user defined components, if that is desirable. The tradeoffs of OO style vs FP style vs having-your-cake-and-eating-it aka the expression problem are well studied. (This comment is a bit cryptic. Sorry. Don&#x27;t have much time right now. Might return later.)<p>My experience using ECS in bevy is it feels like fancy spaghetti code. I&#x27;m not convinced it&#x27;s a great approach, at least on the small scale I&#x27;m working at.
评论 #35208070 未加载
评论 #35208062 未加载
foldrabout 2 years ago
As a relatively old person, I&#x27;ve had a few experiences of waiting for my favorite niche language to finally get a decent GUI library. In my experience, it never happens. It&#x27;s just too much work. Only the most popular few programming languages in any given moment have usable GUI options. Even something as comparatively mainstream as Go lacks a good GUI story.
smodoabout 2 years ago
Interesting that they are working with one of the Zed people. I’ve been wondering about the Ui framework they use. Opening up this framework could invite a lot of attention since they are dogfooding it in a (imho) solid product.
jasmerabout 2 years ago
UIs are inherently about state, and a lot of state is hard in Rust. The big &#x27;tree of state&#x27; is just awkward.<p>UIs are inherently async and event drive, it&#x27;s callbacks over callbacks, again, harder in rust.<p>UIs have a lot of detail. A little screen has a lot of hidden bit of small complexity.<p>Rust is a heavy language that wants to treat every line of code as an existential security threat and performance.<p>It&#x27;s really not the right tool.
rvzabout 2 years ago
Perhaps the most obvious answer is that it is may not be the appropriate language for that use case? It is like suggesting to use Solidity or Assembly to build the UI for your app.
ummonkabout 2 years ago
ECS essentially uses the relational-database-like data storage. To model a tree, ideally you would have ECS but with graph-database-like data storage.
BiteCode_devabout 2 years ago
Great articles, which lead me to check out warps, which looks like a product I would use and consider paying for the pro features. Kudos
taneqabout 2 years ago
Is the challenge really Rust’s design? Or is it an ongoing case of best is the enemy of good? It seems like every UI toolkit we see is another attempt at The Perfect UI Paradigm instead of just being Rust bindings for fltk or whatever.<p>(Oh hey that’s a thing! <a href="https:&#x2F;&#x2F;www.fltk.org&#x2F;articles.php?L1771" rel="nofollow">https:&#x2F;&#x2F;www.fltk.org&#x2F;articles.php?L1771</a> )
2muchcoffeemanabout 2 years ago
Why not have a separate language for UI that calls native rust apis?
评论 #35208430 未加载
pvinisabout 2 years ago
the people over at <a href="https:&#x2F;&#x2F;zed.dev" rel="nofollow">https:&#x2F;&#x2F;zed.dev</a> have done a great job. do they use something special?
classifiedabout 2 years ago
Whoever designed the color scheme for that page has to be blind. But yeah, Rust&#x27;s borrow checker is not designed for GUI apps.
linhnsabout 2 years ago
Because building an UI is hard?
paulsutterabout 2 years ago
English is the new UI
评论 #35207979 未加载
recuterabout 2 years ago
This is a white whale for a lot of people.<p><a href="http:&#x2F;&#x2F;www.areweguiyet.com" rel="nofollow">http:&#x2F;&#x2F;www.areweguiyet.com</a> (seems updates to this thing have stopped?)<p><a href="https:&#x2F;&#x2F;blog.logrocket.com&#x2F;state-of-rust-gui-libraries&#x2F;" rel="nofollow">https:&#x2F;&#x2F;blog.logrocket.com&#x2F;state-of-rust-gui-libraries&#x2F;</a><p>The state of TUI on the other hand is better (posted recently, there are a few others):<p><a href="https:&#x2F;&#x2F;github.com&#x2F;tui-rs-revival&#x2F;ratatui">https:&#x2F;&#x2F;github.com&#x2F;tui-rs-revival&#x2F;ratatui</a><p><a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=35173866" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=35173866</a>
评论 #35207428 未加载
评论 #35207803 未加载
ar9avabout 2 years ago
First of all, it is great that there is are ongoing attempts to build a new approach at creating UI with Rust. I hope it turns out into several competing frameworks with different target audiences.<p>I believe, you are confusing performance with responsiveness. Where a traditional mutating UI framework would happily update a widget and keep CPU idle most of the time, your approach keeps wasting processor cycles to build widget tree on demand for rendering. This could be unacceptable for devices with an energy budget (IOT, for example). So, your approach works well where loss of efficiency is not critical.
评论 #35207537 未加载
评论 #35207420 未加载
tannhaeuserabout 2 years ago
Rust sucks for UI, async services, language runtimes, and a couple other things because memory usage patterns of those apps don&#x27;t favor Rust&#x27;s memory&#x2F;safety model? I mean, who would&#x27;ve thought? Rust was introduced as a &quot;systems&quot; programming language after all, and doesn&#x27;t have to be everything to everybody. Rust isn&#x27;t even extensively used within its originating project&#x2F;org (FF&#x2F;Moz).<p>IMHO, Rust&#x27;s anti-C&#x2F;C++ narrative also starts from wrong assumptions: in traditional Unix, what you&#x27;re doing with C (apart from the OS) is implement the runtime of higher-level languages, but no-one has bothered to implement JavaScript or other engine with GC (let alone JIT) because committing to Rust&#x27;s one-size-fits-all borrow checker just means the result can&#x27;t be competitive. malloc()&#x2F;free() also sucks, but its problems are only amplified by today&#x27;s desire for single-process multithreaded or async backends; for one-shot commandline apps or process-per-request backends OTOH, there hasn&#x27;t been much of a problem.
评论 #35208024 未加载