#frp #gui-applications #gui #reactive #framework #functional #button

cedar

Reactive, functional library for creating GUI applications

3 unstable releases

Uses old Rust 2015

0.1.1 Jul 22, 2017
0.1.0 Jul 22, 2017
0.0.1 Feb 22, 2017

#25 in #frp

MIT license

44KB
1.5K SLoC

cedar 🌲

cedar is a functional-reactive framework.

crates.io License Build Status

Status: cedar is in the alpha stage - not yet ready for prime-time.

Usage

Add cedar to your project via cargo.

Creating buttons & reactive text 🚀

extern crate cedar;

use cedar::dom;
use cedar::dom::Builder;

type Model = i32;

#[derive(PartialEq, Debug, Clone)]
enum Message {
    Increment,
    Decrement,
}

fn update(model: Model, message: Message) -> Model {
    match message {
        Message::Increment => model + 1,
        Message::Decrement => model - 1,
    }
}

fn view(model: &Model) -> dom::Object<Message> {
    dom::stack()
        .add(dom::button().text("+".into()).click(Message::Increment))
        .add(dom::label().text(model.to_string()))
        .add(dom::button().text("-".into()).click(Message::Decrement))
}

fn main() {
    cedar::program(0, update, view)
}

Design

A cedar application is composed of a model, update, and view. TODO: expand on this....

Credits

Inspired by:

cedar is Copyright © Tom Schroeder j.tom.schroeder@gmail.com and released under MIT license.

Dependencies

~0–2.6MB
~65K SLoC