kobold 0.3.0

Crate for building web interfaces
Documentation

Kobold

Easy web interfaces.

Kobold uses macros to deliver familiar JSX-esque syntax for building web interfaces in rust, while leveraging Rust's powerful type system for safety and performance.

There is no need for a full virtual DOM, all static elements are compiled into plain JavaScript functions that construct the DOM elements. All expressions wrapped in { ... } braces are then injected into that DOM, and updated if they change.

Like in React or Yew updates are done by calling a render function/method, but unlike either the [html!][html] macro in Kobold produces transient static types that implement the Html trait. If you have a component that renders a whole bunch of HTML and one i32, only that one i32 is diffed between previous and current render and updated in DOM if necessary.

Hello World

use kobold::prelude::*;

fn main() {
struct Hello {
name: &'static str,
}

impl Hello {
fn render(self) -> impl Html {
html! {
<h1>"Hello "{ self.name }"!"</h1>
}
}
}

kobold::start(html! {
<Hello name={"World"} />
});
}