Expand description
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 { counter: 0 }
}
// `Model` describes our app state.
struct Model { counter: 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.counter += 1,
    }
}
// `view` describes what to display.
fn view(model: &Model) -> Node<Msg> {
    div![
        "This is a counter: ",
        C!["counter"],
        button![
            model.counter,
            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::dom::cast::to_wheel_event;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::error;Deprecated pub use crate::browser::util::html_document;pub use crate::browser::util::log;Deprecated pub use crate::virtual_dom::Attrs;pub use crate::virtual_dom::EventHandler;pub use crate::virtual_dom::Style;pub use futures;pub use wasm_bindgen_futures;
Modules§
- app
 - browser
 - dom_
entity_ names  - future
 - Asynchronous values.
 - helpers
 - prelude
 - Introduce 
ElandTaginto the global namespace for convenience (Elwill be repeated often in the output type of components), andUpdateEl, which is required for element-creation macros, input event constructors, and theHistorystruct. Expose thewasm_bindgenprelude. - 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§
- C
 - Add classes into the element.
 - IF
 IF!(predicate => expression) -> Option<expression value>- Script
 - a
 - abbr
 - address
 - altGlyph
 - altGlyph
Def  - altGlyph
Item  - animate
 - animate
Color  - animate
Motion  - animate
Transform  - applet
 - area
 - article
 - aside
 - attrs
 - Provide a shortcut for creating attributes.
 - audio
 - b
 - bdi
 - bdo
 - blockquote
 - br
 - button
 - canvas
 - caption
 - circle
 - cite
 - class
Deprecated  - Convenience macro. Ideal when there are multiple classes, and no other attrs.
 - clip
Path  - code
 - col
 - colgroup
 - content
 - cursor
 - custom
 - data
 - datalist
 - dd
 - defs
 - del
 - desc
 - details
 - dfn
 - dialog
 - dir
 - discard
 - div
 - dl
 - dt
 - element
 - ellipse
 - em
 - embed
 - empty
 - feBlend
 - feColor
Matrix  - feComponent
Transfer  - feComposite
 - feConvolve
Matrix  - feDiffuse
Lighting  - feDisplacement
Map  - feDrop
Shadow  - feFlood
 - feFuncA
 - feFuncB
 - feFuncG
 - feFuncR
 - feGaussian
Blur  - feImage
 - feMerge
 - feMerge
Node  - feMorphology
 - feOffset
 - feSpecular
Lighting  - feTile
 - feTurbulence
 - fieldset
 - figcaption
 - figure
 - filter
 - font
 - footer
 - foreign
Object  - form
 - g
 - glyph
 - glyph
Ref  - h1
 - h2
 - h3
 - h4
 - h5
 - h6
 - hatch
 - hatchpath
 - header
 - hgroup
 - hkern
 - hr
 - i
 - id
 - Convenience macro, for brevity.
 - iframe
 - image
 - img
 - input
 - ins
 - kbd
 - key_
value_ pairs  - A key-value pairs, where the keys and values must implement 
ToString. - label
 - legend
 - li
 - line_
 - linear
Gradient  - main
 - map
 - mark
 - marker
 - mask
 - menu
 - menuitem
 - mesh
 - mesh
Gradient  - mesh
Patch  - meshrow
 - metadata
 - meter
 - mpath
 - nav
 - nodes
 - Converts items to 
Vec<Node<Ms>and returns flattenedVec<Node<Ms>. - noembed
 - noscript
 - object
 - ol
 - optgroup
 - option
 - output
 - p
 - param
 - path
 - pattern
 - picture
 - plain
 - polygon
 - polyline
 - pre
 - progress
 - q
 - radial
Gradient  - raw
 - raw_svg
 - rb
 - rect
 - rp
 - rt
 - rtc
 - ruby
 - s
 - samp
 - section
 - select
 - set
 - shadow
 - slot
 - small
 - solidcolor
 - source
 - span
 - stop
 - strong
 - struct_
urls  - Create struct 
Urls. It’s useful especially for buildingUrls in nested modules. - style
 - Provide a shortcut for creating styles.
 - sub
 - summary
 - sup
 - svg
 - switch
 - symbol
 - table
 - tbody
 - td
 - template
 - text
 - text
Path  - textarea
 - tfoot
 - th
 - thead
 - time
 - title
 - tr
 - track
 - tref
 - tspan
 - tt
 - u
 - ul
 - unit
 - unknown
 - use
 - var
 - video
 - view
 - vkern
 - wbr
 - with_
dollar_ sign  - Allows to write nested macros.
 
Structs§
- JsFuture
 - A Rust 
Futurebacked by a JavaScriptPromise. 
Traits§
- Future
Ext  - An extension trait for 
Futures that provides a variety of convenient adapters. - TryFuture
Ext  - Adapters specific to 
Result-returning futures 
Functions§
- document
 - Convenience function to access the web_sys DOM document.
 - empty
 - Create an element flagged in a way that it will not be rendered. Useful in ternary operations.
 - history
 - Convenience function to access the web_sys history.
 - set_
interval Deprecated  - A high-level wrapper for 
web_sys::window.set_interval_with_callback_and_timeout_and_arguments_0: - set_
timeout Deprecated  - See 
set_interval - spawn_
local  - Runs a Rust 
Futureon the current thread. - window
 - Convenience function to avoid repeating expect logic.