[−][src]Struct seed::App
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]
model: Mdl,
update: fn(_: Ms, _: Mdl) -> Update<Mdl>,
view: fn(_: App<Ms, Mdl>, _: &Mdl) -> El<Ms>
) -> AppBuilder<Ms, Mdl>
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]
F: Fn(&Ms) + 'static,
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,