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
Scope
s. - 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
andview
functions. Also this module contains declaration ofComponent
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.