by wishawa on 10/5/22, 12:14 AM with 92 comments
by HippoBaro on 10/5/22, 5:37 AM
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.
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.
Kudos to the library writer though!
by wishawa on 10/5/22, 12:24 AM
P.S. My website is new, so if you find any readability or accessibility issue, please let me know!
by mbStavola on 10/5/22, 5:39 AM
The login form example which returns values reminds me a lot of imgui and other immediate mode GUI frameworks.
by wruza on 10/5/22, 9:05 AM
by meltedcapacitor on 10/5/22, 1:38 PM
I´d expect an async UI to be in "immediate UI" style, e.g.:
async fn give_em_cookies(window:Win) {
win.title("Cookies!");
win.columnwise();
win.label("Which cookie do you like?");
let cookie = win.selector(&["Shortbread", "Chocolate chip"]).await;
win.label("When to you want to eat the cookie?");
win.rowwise();
if win.button("Now!").await { eat_cookie_now(cookie); }
if win.button("Later!").await { eat_coookie_later(cookie); }
if win.closed().await { no_cookie_eaten(); }
}
// the function represents the state machine that encodes
// the behaviour of the dialog box, which the caller gives to UI
// engine for rendering
ui.display(give_em_cookies(Window::new())).await;
by lucasyvas on 10/5/22, 3:04 AM
by royjacobs on 10/5/22, 6:44 AM
I'm not sure the complexity of doing everything using async constructs is worth it, though. Large-scale UI's built in Qt or Javascript are mostly single threaded anyway, but it's still worthwhile to explore so kudos for that. Looking forward to seeing how far you get.
by ohgodplsno on 10/5/22, 2:15 PM
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'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).
Not blocking the UI thread is mandatory if you ever want to make any kind of complex UI. If you're a web dev, well you only have one thread anyways, good luck, if you'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.
Stack traces are a problem, but then again they've been a problem in any remotely capable UI toolkit.
With ReactiveCell, it looks surprisingly similar to what Compose does, where modifying a State<T> causes recomposition of everything observing it. Which means that it might be powerful enough one day to do the same things as Molecule (https://github.com/cashapp/molecule), or ComposePPT (https://github.com/fgiris/composePPT), where everything is a potential target and it interops really well with existing toolkits.
by gwbas1c on 10/5/22, 1:25 PM
One thing I like is that the code appears to flow more like a console app than a GUI app. I've always found it's easy to create a quick-and-dirty console app; but if I want to do a quick-and-dirty UI (windows) app, it's much more time consuming.
This is because, with console IO, you can write your UI in a very linear manner. With UI (windows), it's much harder to write the code in a linear manner.
by tayistay on 10/5/22, 4:55 PM
https://github.com/wishawa/async_ui/blob/main/examples/web-t...
by cottsak on 10/5/22, 5:02 AM
how did we all survive before async UI... ¬‿¬
by cyber_kinetist on 10/5/22, 7:58 AM
by voorwerpjes on 10/5/22, 6:00 AM
I don't understand the motivation about lifetimes in sync rust not being able to be arbitrary. I'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?
by qwerty456127 on 10/5/22, 12:55 PM
by jcelerier on 10/5/22, 2:03 PM
by adamnemecek on 10/5/22, 5:17 AM
by davidatbu on 10/5/22, 5:17 AM
by avrionov on 10/5/22, 4:09 AM
by pharmakom on 10/5/22, 6:55 AM
by your_challenger on 10/5/22, 10:37 AM
by Existenceblinks on 10/5/22, 2:00 PM
by cercatrova on 10/5/22, 7:34 AM
by debdut on 10/5/22, 10:01 AM
by fyvhbhn on 10/5/22, 9:08 AM
I feel like it is pretty close even though you don't see the async exposed? L
by SeniorMars on 10/5/22, 12:48 PM