Expand description
Yew Framework - API Documentation
Yew 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.
Minimal example:
extern crate yew;
use yew::html::*;
struct Model {
value: i64,
}
enum Msg {
DoIt,
}
fn update(context: &mut Context<Msg>, model: &mut Model, msg: Msg) {
match msg {
Msg::DoIt => {
model.value = model.value + 1;
}
}
}
fn view(model: &Model) -> Html<Msg> {
html! {
<div>
<button onclick=|_| Msg::Increment,>{ "Add +1" }</button>
<p>{ model.value }</p>
</div>
}
}
fn main() {
let model = Model {
value: 0,
};
program(model, update, view);
}
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.Utility module to convert data to types and back by
specific formats like: JSON, BSON, TOML, YAML, XML.
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 is a container of servies to interact with the external resources.
This module contains the implementation of reactive virtual dom concept.
Macros
Functions
Initializes yew framework. It should be called first.
Starts event loop.