#desktop #experimental #applications #multi-threading #declarative #was #generally

quarve

Experimental desktop GUI framework that's multithreaded, declarative and designed for Rust

4 releases

new 0.1.3 Jan 19, 2025
0.1.2 Jan 13, 2025
0.1.1 Jan 13, 2025
0.1.0 Jan 13, 2025

#290 in GUI

Download history 265/week @ 2025-01-11

265 downloads per month

MIT license

1MB
22K SLoC

Rust 18K SLoC // 0.0% comments C++ 1.5K SLoC // 0.0% comments Objective-C 1.5K SLoC // 0.0% comments

Quarve

Quarve is in pre-alpha. Use at your own risk

Quarve is an experimental rust UI library for desktop applications. It was made to develop Monocurl, a mathematical animation app, but can be used more generally.

Learn how to use Quarve from the official Quarve Book.

Example

Button and counter example.

fn counter(s: MSlock) -> impl IVP {
    // state
    let count = Store::new(0);
    let count_binding = count.binding();
    let count_label = count.map(|c| format!("Count: {:?}", c), s);

    // views
    let button = button("Increment", move |s| {
        count_binding.apply(NumericAction::Incr(1), s);
    });
    let display = Text::from_signal(count_label);

    vstack()
        .push(button.bold())
        .push(display)
        .text_color(BLACK)
        .frame(F.intrinsic(400, 400).unlimited_stretch())
        .background(WHITE)
}

Preview Counter App

You can run any of the examples in this repository by using the command quarve run -n <example_name> where <example_name> can be any of conditional, flex, multithread, scroll, textview

Installation

After installing cargo, run

cargo install quarve_cli

You can then create a Quarve project with the command quarve new <name>. Run the project either by running it as a normal rust binary or by using quarve run.

Design Principles

We designed Quarve to satisfy the core principles:

  1. Multithreaded Quarve extends Rust's fearless concurrency to multithreaded app development.
  2. Declarative We aim to make the syntax of Quarve convenient to read, without overly relying on macros. Quarve also follows the pattern of composability, allowing for reusable and easy-to-understand code.
  3. Rust-first As opposed to being a port of a UI library designed for another language, Quarve is built around the features that define Rust: monomorphism, thread safety, composition, speed, and more.
  4. Native Quarve views are native-backed, avoiding web browsers and gpu renderers. This allows for small installation size and memory footprint.
  5. Fast We do not use virtual doms and aim for minimal overheard compared to a fully native application (there is still some work to do).

Currently, Quarve is implemented for macOS, Windows and Linux. There are many features that are yet to be added, but the basics are implemented.

Documentation is available at docs.rs.

For further learning, we recommend looking through the Monocurl source code as it is the most complex application using Quarve. Otherwise, feel free to ask for help in the Discord server.

Dependencies

~1.3–2.2MB
~46K SLoC