[−][src]Crate seed
Visit the website
See the github Readme for details
Counter Example
use seed::{prelude::*, *}; // `init` describes what should happen when your app started. fn init(_: Url, _: &mut impl Orders<Msg>) -> Model { Model::default() } // `Model` describes our app state. type Model = i32; // `Msg` describes the different events you can modify state with. enum Msg { Increment, } // `update` describes how to handle each `Msg`. fn update(msg: Msg, model: &mut Model, _: &mut impl Orders<Msg>) { match msg { Msg::Increment => *model += 1, } } // `view` describes what to display. fn view(model: &Model) -> Node<Msg> { div![ "This is a counter: ", C!["counter"], button![ model, ev(Ev::Click, |_| Msg::Increment), ], ] } #[wasm_bindgen(start)] pub fn start() { // Mount the `app` to the element with the `id` "app". App::start("app", init, update, view); }
Re-exports
| pub use crate::app::App; | 
| pub use crate::browser::dom::cast::to_drag_event; | 
| pub use crate::browser::dom::cast::to_html_el; | 
| pub use crate::browser::dom::cast::to_input; | 
| pub use crate::browser::dom::cast::to_keyboard_event; | 
| pub use crate::browser::dom::cast::to_mouse_event; | 
| pub use crate::browser::dom::cast::to_select; | 
| pub use crate::browser::dom::cast::to_textarea; | 
| pub use crate::browser::dom::cast::to_touch_event; | 
| pub use crate::browser::fetch; | 
| pub use crate::browser::url::Url; | 
| pub use crate::browser::util; | 
| pub use crate::browser::util::body; | 
| pub use crate::browser::util::canvas; | 
| pub use crate::browser::util::canvas_context_2d; | 
| pub use crate::browser::util::cookies; | 
| pub use crate::browser::util::document; | 
| pub use crate::browser::util::error; | 
| pub use crate::browser::util::history; | 
| pub use crate::browser::util::html_document; | 
| pub use crate::browser::util::log; | 
| pub use crate::browser::util::window; | 
| pub use crate::virtual_dom::Attrs; | 
| pub use crate::virtual_dom::EventHandler; | 
| pub use crate::virtual_dom::Style; | 
| pub use console_error_panic_hook; | 
| pub use futures; | 
| pub use wasm_bindgen_futures; | 
Modules
| app | |
| browser | |
| dom_entity_names | |
| future | Asynchronous values. | 
| helpers | |
| prelude | Introduce  | 
| shortcuts | This file exports helper macros for element creation, populated by a higher-level macro, and macros for creating the parts of elements. (attrs, style, events) | 
| virtual_dom | 
Macros
Structs
| JsFuture | A Rust  | 
Traits
| FutureExt | An extension trait for  | 
| TryFutureExt | Adapters specific to  | 
Functions
| empty | Create an element flagged in a way that it will not be rendered. Useful in ternary operations. | 
| set_interval | Deprecated A high-level wrapper for  | 
| set_timeout | Deprecated See  | 
| spawn_local | Runs a Rust  |