#async #utils #ui

async_ui_internal_utils

for internal use only

1 unstable release

0.0.2 Jul 24, 2023

#309 in #ui

Download history 21/week @ 2023-08-07 24/week @ 2023-08-14 4/week @ 2023-08-21 10/week @ 2023-08-28 20/week @ 2023-09-04 14/week @ 2023-09-11 13/week @ 2023-09-18 14/week @ 2023-09-25 11/week @ 2023-10-02 92/week @ 2023-10-09 20/week @ 2023-10-16 17/week @ 2023-10-23 16/week @ 2023-10-30 18/week @ 2023-11-06 19/week @ 2023-11-13 19/week @ 2023-11-20

72 downloads per month
Used in 4 crates

MPL-2.0 license

14KB
340 lines

Async UI

A web UI framework where Futures are components.

Async UI is...

  • Just async Rust; if you know what Futures are and how to join them, you know 90% of Async UI already.
  • Transparent; we favor imperative async code, avoiding callbacks and custom DSLs.
  • Flexible; you get access to the entire Web API (through web_sys).

Example Code: Hello World

async fn hello_world() {
    "Hello World".render().await;
}

Example Code: Counter

async fn counter() {
    let mut count = 0;
    let value_text = Text::new();
    let incr_button = Button::new();
    join((
        value_text.render(),
        incr_button.render("Increment".render()),
        async {
            loop {
                value_text.set_data(&count.to_string());
                incr_button.until_click().await;
                count += 1;
            }
        },
    ))
    .await;
}

Example Code: Async Control Flow

async fn app() {
    let resource = loading_indicator(
        fetch_resource()
    ).await;
    show_resource(&resource).await;
}

Design

WIP. Please check back later.

Dependencies

~26KB