Crates.io | cedar |
lib.rs | cedar |
version | 0.1.1 |
source | src |
created_at | 2017-02-22 02:12:45.292543 |
updated_at | 2017-08-02 14:52:22.704919 |
description | Reactive, functional library for creating GUI applications |
homepage | https://github.com/jtomschroeder/cedar |
repository | https://github.com/jtomschroeder/cedar |
max_upload_size | |
id | 8625 |
size | 46,098 |
cedar
is a functional-reactive framework.
Status: cedar
is in the alpha stage - not yet ready for prime-time.
Add cedar
to your project via cargo.
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)
}
A cedar
application is composed of a model, update, and view. TODO: expand on this....
Inspired by:
cedar
is Copyright © Tom Schroeder j.tom.schroeder@gmail.com and released under MIT license.