1 unstable release
| 0.0.1-alpha.1 | Jun 28, 2025 |
|---|
#1288 in GUI
56 downloads per month
Used in 5 crates
(4 directly)
14KB
209 lines
🚧 WIP: Zintl - Building GUI with Rust
| Source code | Crates.io | Docs |
Stateful counter app example
use zintl::*;
#[derive(Default)]
struct HelloWorld {
count: usize,
context: Context,
}
impl HelloWorld {
pub fn new(count: usize) -> Self {
HelloWorld {
count,
...Default::default(),
}
}
}
impl Composable for HelloWorld {
fn compose(&self) -> impl View {
VStack::new().children(v![
Label::new("Hello, world!"),
Label::new(format!("Count: {}", self.count),
Button::new("Increment").on_click(||
self.count += 1;
})
])
}
}
fn main() {
let app = App::new(
StatefulView::new::<usize>(marker!(), 0, |value| {
HelloWorld::new(value)
}),
);
run_app(app);
}