Introducing Comet, an Isomorphic Reactive web framework in Rust+Wasm

69 points ChampiiPote

Hello everybody,

I've worked on this little prototype the last weeks, and it has reached a state where I can start to show it to you ! This is still not stable, nor completed, I'm looking for impressions, advices and constructive criticism :)

This is an isomorphic reactive framework , meaning you only write the code once for both the client and the server. The API and the general concept are still a work in progress and there are some ugly things in the implementation that will need to change in the future.

Anyway, here is a basic client/server Todo component, with a \toggle\\ that saves the changes in DB:

#[model]
struct Todo {
    title: String,
    completed: bool,
}

impl Todo {
    pub async fn toggle(&mut self) {
        self.completed = !self.completed;

        self.save().await;
    }
}

component! {
    Todo,
    div {
        p {
            { self.title }
            { self.completed }
            button @click: { self.toggle().await } {
                { "Toggle" }
            }
        }
    }
}

comet::run!(Todo::default().create().await.unwrap());

Link if you want to see more: https://github.com/Champii/Comet

​

Edit: Cleaner example