Would you build Rust GUIs like this?
Hey folks! For a while, I've been working on this project for Rust GUIs called Pax. I recently decided to "launch early" and start developing it in the open.
Pax extends Rust with a syntax for declarative component-based GUIs. Pax is in alpha preview.
Would you use an approach like the following for building GUIs in Rust? What do you like/dislike about it? What questions would you have about it? What tough use-case might you have for it? How clear are the messaging & documentation? Any thoughts, friendly and critical, are welcome.
//increment-me.rs
use pax::*;
use pax_std::{Text};
use pax_std::forms::{Button, ArgsButtonSubmit};
use pax_std::layout::{Stacker};
#[pax(
<Stacker cells=2>
<Text>{"I have been clicked " + self.num_clicks + " times."}</Text>
<Button @submit=self.increment>"Increment me!"</Button>
</Stacker>
)]
pub struct IncrementMe {
pub num_clicks: Property<i64>
}
impl IncrementMe {
pub async fn increment(mut self, args: ArgsButtonSubmit) {
let old_num_clicks = self.num_clicks.get();
self.num_clicks.set(old_num_clicks + 1);
}
}
The above defines a UI component, IncrementMe, which may then be used elsewhere via use crate::IncrementMe; in Rust and <IncrementMe /> in a Pax template
Much of the above functionality is already built or underway -- see:
- The project on GitHub
- The website
- The docs
- A running example
p.s. seeking collaborators! EDIT: re-formatted code example to be friendlier to old.reddit.com