concoct 0.6.5

Cross-platform UI framework
docs.rs failed to build concoct-0.6.5
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: concoct-0.19.0-alpha.2

Rust cross-platform reactive UI framework.

enum Event {
    Increment,
    Decrement,
}

fn counter(count: &i32) -> impl View<Web<Event>> {
    (
        Html::h1((), count.to_string()),
        once(Html::button(on("click", |_| Event::Increment), "More")),
        once(Html::button(on("click", |_| Event::Decrement), "Less")),
    )
}

fn main() {
    concoct::web::run(
        0,
        |count, event| match event {
            Event::Increment => *count += 1,
            Event::Decrement => *count -= 1,
        },
        counter,
    );
}

Features

  • Cross-platform components
  • Compile-time UI tree
  • Efficient view updates
  • Inspired by the elm and xilem architectures

Getting started

Web

Install trunk or wasm-pack (this tutorial will show serving with trunk).

cargo add concoct --features web

Create an index.html file in the crate root

<html>
    <body></body>
</html>

Create a main view and run it with Concoct

fn app(_state: &()) -> impl View<Web<()>> {
    Html::h1((), "Hello World!"),
}

fn main() {
    concoct::web::run(
        0,
        |_state, _event| {},
        app,
    );
}
trunk serve

All done! Check it out at http://localhost:8080