nuit 0.0.8

Declarative, cross-platform UI library for Rust that uses native controls
docs.rs failed to build nuit-0.0.8
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: nuit-0.2.0

Nuit

Build

A declarative, cross-platform UI library for Rust that uses native controls.

Crate Description Version Docs
nuit Umbrella crate for the library crates.io docs.rs
nuit-bridge-adwaita Adwaita backend (Linux, macOS) crates.io docs.rs
nuit-bridge-swiftui SwiftUI backend (macOS, iOS) crates.io docs.rs
nuit-core Core structures and traits crates.io docs.rs
nuit-derive Derive macros crates.io docs.rs

Nuit's API takes inspiration from SwiftUI, Xilem, React and a number of other frameworks, while itself using SwiftUI under the hood on macOS.

[!NOTE] Nuit currently requires a nightly Rust toolchain as it uses a number of cutting edge/unstable compiler features, including

With rustup this can be configured conveniently on a per-directory basis rustup override set nightly or, as in this repository, automatically with a rust-toolchain.toml.

Example

use nuit::{Text, VStack, View, Bind, Button, State};

#[derive(Bind)]
struct CounterView {
    count: State<i32>,
}

impl CounterView {
    fn new() -> Self {
        Self { count: State::new(0) }
    }
}

impl View for CounterView {
    type Body = impl View;

    fn body(&self) -> Self::Body {
        let count = self.count.clone();
        VStack::new((
            Text::new(format!("Count: {}", count.get())),
            Button::new(Text::new("Increment"), move || {
                count.set(count.get() + 1);
            })
        ))
    }
}

fn main() {
    nuit::run_app(CounterView::new());
}

Running this example, e.g. with cargo run --example counter, launches:

SwiftUI Adwaita (GTK4)