[][src]Struct seed::App

pub struct App<Ms: Clone + 'static, Mdl: 'static + Clone> {
    pub cfg: Rc<AppCfg<Ms, Mdl>>,
    pub data: Rc<AppData<Ms, Mdl>>,
}

Fields

cfg: Rc<AppCfg<Ms, Mdl>>

Stateless app configuration

data: Rc<AppData<Ms, Mdl>>

Mutable app state

Methods

impl<Ms: Clone, Mdl: Clone> App<Ms, Mdl>[src]

We use a struct instead of series of functions, in order to avoid passing repetative sequences of parameters.

pub fn build(
    model: Mdl,
    update: fn(_: Ms, _: Mdl) -> Update<Mdl>,
    view: fn(_: App<Ms, Mdl>, _: &Mdl) -> El<Ms>
) -> AppBuilder<Ms, Mdl>
[src]

pub fn run(self) -> Self[src]

App initialization: Collect its fundamental components, setup, and perform an initial render.

pub fn update(&self, message: Ms)[src]

This runs whenever the state is changed, ie the user-written update function is called. It updates the state, and any DOM elements affected by this change. todo this is where we need to compare against differences and only update nodes affected by the state change.

We re-create the whole virtual dom each time (Is there a way around this? Probably not without knowing what vars the model holds ahead of time), but only edit the rendered, web_sys dom for things that have been changed. We re-render the virtual DOM on every change, but (attempt to) only change the actual DOM, via web_sys, when we need. The model storred in inner is the old model; updated_model is a newly-calculated one.

pub fn add_message_listener<F>(&self, listener: F) where
    F: Fn(&Ms) + 'static, 
[src]

Trait Implementations

impl<Ms: Clone, Mdl: Clone> Clone for App<Ms, Mdl>[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl<Ms, Mdl> !Send for App<Ms, Mdl>

impl<Ms, Mdl> !Sync for App<Ms, Mdl>

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]