Crate plaster

Source
Expand description

§Plaster Framework - API Documentation

Plaster is a framework for web-client apps created with a modern Rust-to-Wasm compilation feature. This framework was highly inspired by Elm and React. Forked originally from Yew.

Minimal example:

#[macro_use]
extern crate plaster;
use plaster::prelude::*;

struct Model {
    value: i64,
}

enum Msg {
    DoIt,
}

impl Component for Model {
    type Message = Msg;
    type Properties = ();
    fn create(_: Self::Properties, _: ComponentLink<Self>) -> Self {
        Self {
            value: 0,
        }
    }

    fn update(&mut self, msg: Self::Message) -> ShouldRender {
        match msg {
            Msg::DoIt => self.value = self.value + 1
        }
        true
    }
}

impl Renderable<Model> for Model {
    fn view(&self) -> Html<Self> {
        html! {
            <div>
               <button onclick=|_| Msg::DoIt,>{ "+1" }</button>
                <p>{ self.value }</p>
            </div>
        }
    }
}

#[wasm_bindgen(start)]
fn main() {
    App::<Model>::new().mount_to_body();
}

Modules§

app
This module contains App sctruct which used to bootstrap a component in an isolated scope.
callback
This module contains structs to interact with Scopes.
components
This module contains useful components. At this moment it includes typed Select only.
html
The main module which contents aliases to necessary items to create a template and implement update and view functions. Also this module contains declaration of Component trait which used to create own UI-components.
macros
This module contains macros which implements html! macro and JSX-like templates.
prelude
The Yew Prelude
scheduler
This module contains a scheduler.
virtual_dom
This module contains the implementation of reactive virtual dom concept.

Macros§

html
some docs
html_impl
some docs