ivanceras / cedar

Framework for building functional-reactive applications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cedar 🌲

cedar is a functional-reactive GUI library.

crates.io License Build Status

Status: cedar is in the alpha stage and currently only supports macOS (cocoa) - not yet ready for prime-time.

Usage

Add this to Cargo.toml:

[dependencies]
cedar = { git = "https://github.com/jtomschroeder/cedar" }

and this to the root of your crate:

extern crate cedar;

Creating buttons & reactive text 🚀

extern crate cedar;

type Model = i32;

enum Message {
    Increment,
    Decrement,
}

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

fn view() -> cedar::View<Model, Message> {
    cedar::View::new()
        .button(|button| {
            button.text("+")
                .click(|| Message::Increment)
        })
        .label(|label| label.text(Model::to_string))
        .button(|button| {
            button.text("-")
                .click(|| Message::Decrement)
        })
}

fn main() {
    cedar::Program::new(0, update, view).run()
}

Design

A cedar application is composed of a model, update, and view.

Credits

Inspired by:

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

About

Framework for building functional-reactive applications

License:MIT License


Languages

Language:Rust 100.0%