https://github.com/jazzfool/cape
Rust UI
https://github.com/jazzfool/cape
Last synced: 11 months ago
JSON representation
Rust UI
- Host: GitHub
- URL: https://github.com/jazzfool/cape
- Owner: jazzfool
- Created: 2021-02-24T07:24:08.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2022-02-20T12:14:11.000Z (over 4 years ago)
- Last Synced: 2025-01-23T22:14:03.307Z (over 1 year ago)
- Language: Rust
- Size: 291 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Cape
### *(yet another) Desktop UI library in Rust*
*\*inspired by React, Moxie, and Crochet*
---
- No `RefCell`
- No global state
- Reactive & declarative
- Caching helpers
- Retained DOM-like backing tree (reconciliation)
- No `unsafe` beyond rendering code
---
```rust
#[cape::ui]
fn counter(cx: &mut Cx) -> impl IntoNode {
let count = cx.state(|| 0);
Column::new()
.spacing(5.)
.child(format!("Count: {}", cx.at(count)))
.child(
Row::new()
.spacing(5.)
.child(
Button::new(cx)
.child("Increment")
.on_click(move |cx, _| *cx.at(count) += 1),
)
.child(
Button::new(cx)
.child("Decrement")
.on_click(move |cx, _| *cx.at(count) -= 1),
),
)
}
```
---
### What's missing
- Multiple windows
- Long list views (direct DOM mutation)
- Z-order (implies a simple layer compositor)
- Correct text input (IME)
- Accessibility (first priority would be Microsoft UIAutomation)
Not quite as sophisticated as Crochet, more based around empirical needs and wants.
## Maintenance
There's no need for new UI libraries in Rust, as such I may not be very active or responsive. Think of this more as a tech demo, i.e. don't use it for any project you care about.