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
This module contains
App
sctruct which used to bootstrap
a component in an isolated scope.This module contains structs to interact with
Scope
s.This module contains useful components.
At this moment it includes typed
Select
only.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.This module contains macros which implements
html!
macro
and JSX-like templates.The Yew Prelude
This module contains a scheduler.
This module contains the implementation of reactive virtual dom concept.