wishawa / async_ui

Lifetime-Friendly, Component-Based, Retained-Mode UI Powered by Async Rust
Mozilla Public License 2.0
551 stars 11 forks source link
async rust ui

Async UI

crates.io crates.io

A web UI framework where Futures are components.

Overview (for the User)

Async UI is...

See hosted demos

Get Started Now!

Overview (for the UI Framework Connoisseur)

Read more about the framework

Example Code: Hello World

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

Example Code: Async Control Flow

async fn app() {
    let resource = loading_indicator(
        fetch_resource()
    ).await;
    show_resource(&resource).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;
}