TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: Async UI: A Rust UI Library Where Everything is a Future

173 点作者 wishawa超过 2 年前

25 条评论

HippoBaro超过 2 年前
(Context: I write async rust professionally)<p>Fly you fools. This will be a nightmare to debug, introspect and reason about for a speed boost that you (and your users) won’t be able to measure.<p>If you want to build a native app, more power to you. There are simpler languages that will enable you to do that with a much higher productivity.<p>Kudos to the library writer though!
评论 #33092187 未加载
评论 #33092867 未加载
评论 #33096378 未加载
评论 #33094813 未加载
wishawa超过 2 年前
Hi HN! I&#x27;ve been working on Async UI for half a year now, and I think it is time I share it with everyone. The project is not even really usable yet (due to lack of implemented components and documentation), but I think the proof-of-concept is enough to demonstrate this new way of doing UI — a way that, I believe, is more suitable to Rust than existing UI framework designs.<p>P.S. My website is new, so if you find any readability or accessibility issue, please let me know!
评论 #33090479 未加载
评论 #33096339 未加载
mbStavola超过 2 年前
I must admit, I was a bit skeptical when reading the title, but after reading I&#x27;m super interested.<p>The login form example which returns values reminds me a lot of imgui and other immediate mode GUI frameworks.
wruza超过 2 年前
We’re almost back to if (MB_OK == MessageBoxA(…)) and other modal forms, just need to wait a little more for this ui insanity to end and life can be good again.
meltedcapacitor超过 2 年前
Seems a weird mix of async and callbacks spaghetti.<p>I´d expect an async UI to be in &quot;immediate UI&quot; style, e.g.:<p><pre><code> async fn give_em_cookies(window:Win) { win.title(&quot;Cookies!&quot;); win.columnwise(); win.label(&quot;Which cookie do you like?&quot;); let cookie = win.selector(&amp;[&quot;Shortbread&quot;, &quot;Chocolate chip&quot;]).await; win.label(&quot;When to you want to eat the cookie?&quot;); win.rowwise(); if win.button(&quot;Now!&quot;).await { eat_cookie_now(cookie); } if win.button(&quot;Later!&quot;).await { eat_coookie_later(cookie); } if win.closed().await { no_cookie_eaten(); } } &#x2F;&#x2F; the function represents the state machine that encodes &#x2F;&#x2F; the behaviour of the dialog box, which the caller gives to UI &#x2F;&#x2F; engine for rendering ui.display(give_em_cookies(Window::new())).await;</code></pre>
评论 #33097626 未加载
lucasyvas超过 2 年前
This is wild to me... how does that login_form function work? If awaiting renders, then it can also return values?
评论 #33091090 未加载
royjacobs超过 2 年前
The programming model reminds me of Rob Eisenberg&#x27;s older attempts at building UI toolkits ([0]). I don&#x27;t recall if that was fully async or &#x27;just&#x27; using a coroutine&#x2F;generator-style approach, but it feels similar.<p>I&#x27;m not sure the complexity of doing everything using async constructs is worth it, though. Large-scale UI&#x27;s built in Qt or Javascript are mostly single threaded anyway, but it&#x27;s still worthwhile to explore so kudos for that. Looking forward to seeing how far you get.<p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;Caliburn-Micro&#x2F;Caliburn.Micro" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Caliburn-Micro&#x2F;Caliburn.Micro</a>
ohgodplsno超过 2 年前
Today in &quot;HN never used a reactive framework that is not React and is offended when UI is not written with Dear ImGui&quot;.<p>This is literally the exact style of SwiftUI and Jetpack Compose (down to the author having used the term fragment, I sure hope this isn&#x27;t leftover trauma from being an Android developer), except written in Rust (hence having to deal with lifetimes in the middle, default parameters, lambdas being quite verbose and needing to move things, etc).<p>Not blocking the UI thread is mandatory if you ever want to make any kind of complex UI. If you&#x27;re a web dev, well you only have one thread anyways, good luck, if you&#x27;re on any other platform, interactions _cannot_ ever block the UI (unless you, yourself, update the UI to say it is blocked). Making this async is a good thing.<p>Stack traces are a problem, but then again they&#x27;ve been a problem in any remotely capable UI toolkit.<p>With ReactiveCell, it looks surprisingly similar to what Compose does, where modifying a State&lt;T&gt; causes recomposition of everything observing it. Which means that it might be powerful enough one day to do the same things as Molecule (<a href="https:&#x2F;&#x2F;github.com&#x2F;cashapp&#x2F;molecule" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;cashapp&#x2F;molecule</a>), or ComposePPT (<a href="https:&#x2F;&#x2F;github.com&#x2F;fgiris&#x2F;composePPT" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;fgiris&#x2F;composePPT</a>), where everything is a potential target and it interops really well with existing toolkits.
gwbas1c超过 2 年前
Hopefully I can find some time in my busy schedule to try this.<p>One thing I like is that the code appears to flow more like a console app than a GUI app. I&#x27;ve always found it&#x27;s easy to create a quick-and-dirty console app; but if I want to do a quick-and-dirty UI (windows) app, it&#x27;s much more time consuming.<p>This is because, with console IO, you can write your UI in a very linear manner. With UI (windows), it&#x27;s much harder to write the code in a linear manner.
tayistay超过 2 年前
This is an interesting idea, but if you look at bigger examples, such as the todo-list example, the code is littered with `async` noise, calls to `borrow()`, and other fancy stuff like reducers. (A todo list is easily expressed in SwiftUI without much ceremony) Seems like scaling up to actual apps would be a mess.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;wishawa&#x2F;async_ui&#x2F;blob&#x2F;main&#x2F;examples&#x2F;web-todomvc&#x2F;src&#x2F;lib.rs" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;wishawa&#x2F;async_ui&#x2F;blob&#x2F;main&#x2F;examples&#x2F;web-t...</a>
评论 #33098859 未加载
cottsak超过 2 年前
<i>sigh</i><p>how did we all survive before async UI... ¬‿¬
评论 #33093634 未加载
评论 #33099589 未加载
cyber_kinetist超过 2 年前
I wonder if one can do this with coroutines in a more ergonomic way. Lua might be a good candidate language to create such a UI framework…
voorwerpjes超过 2 年前
Very cool!<p>I don&#x27;t understand the motivation about lifetimes in sync rust not being able to be arbitrary. I&#x27;m also confused because most of the time went you want to send data around in a async context you wrap it in `arc`, which has the pretty much analogous `rc` in a sync context which would also solve the lifetimes issue. Is there something I am missing?
评论 #33092525 未加载
qwerty456127超过 2 年前
I always dreamt of a GUI library where every widget would be a separate actor sending and receiving messages.
评论 #33095177 未加载
jcelerier超过 2 年前
i&#x27;m really curious about the UI performance. a very good way to get lower latency in my usually callback-driven code is to move to synchronous things as far as possible - every callback has a cost, and these costs really add up especially if you want as fast as a startup as is possible for your app. And every step in a coroutine in an event-driven system is pretty close conceptually to a callback, isn&#x27;t it ?
adamnemecek超过 2 年前
You might be interested in RUI <a href="https:&#x2F;&#x2F;github.com&#x2F;audulus&#x2F;rui" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;audulus&#x2F;rui</a>
评论 #33091753 未加载
davidatbu超过 2 年前
So, does this work with an application that uses tokio?
评论 #33091705 未加载
avrionov超过 2 年前
Your scientists were so preoccupied with whether or not they could, they didn&#x27;t stop to think if they should.
pharmakom超过 2 年前
Looks a bit like concur JS
评论 #33099699 未加载
your_challenger超过 2 年前
This is very Compose (Android) and Swift UI (iOS) like. I love it!
Existenceblinks超过 2 年前
It&#x27;s 2.56 MB gzip!
评论 #33099629 未加载
cercatrova超过 2 年前
Isn&#x27;t this basically retained mode vs immediate mode GUIs?
debdut超过 2 年前
has a SwiftUI resemblance, nice :)
评论 #33098143 未加载
fyvhbhn超过 2 年前
Could you compare it with Sycamore with a few bullet points?<p>I feel like it is pretty close even though you don&#x27;t see the async exposed? L
评论 #33099892 未加载
SeniorMars超过 2 年前
I love you wisha &lt;3