[−][src]Struct seed::App
Fields
cfg: Rc<AppCfg<Ms, Mdl, ElC>>
Stateless app configuration
data: Rc<AppData<Ms, Mdl>>
Mutable app state
Methods
impl<Ms: Clone, Mdl, ElC: ElContainer<Ms> + 'static> App<Ms, Mdl, ElC>
[src]
We use a struct instead of series of functions, in order to avoid passing repetitive sequences of parameters.
pub fn build(
model: Mdl,
update: fn(_: Ms, _: &mut Mdl) -> Update<Ms>,
view: fn(_: &Mdl) -> ElC
) -> AppBuilder<Ms, Mdl, ElC>
[src]
model: Mdl,
update: fn(_: Ms, _: &mut Mdl) -> Update<Ms>,
view: fn(_: &Mdl) -> ElC
) -> AppBuilder<Ms, Mdl, ElC>
pub fn setup_window_listeners(&self)
[src]
pub fn run(self) -> Self
[src]
App initialization: Collect its fundamental components, setup, and perform an initial render.
pub fn update_inner(
&self,
message: Ms
) -> Option<Box<dyn Future<Item = (), Error = ()> + 'static>>
[src]
&self,
message: Ms
) -> Option<Box<dyn Future<Item = (), Error = ()> + 'static>>
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 stored in inner is the old model; updated_model is a newly-calculated one.
pub fn update(&self, message: Ms)
[src]
pub fn add_message_listener<F>(&self, listener: F) where
F: Fn(&Ms) + 'static,
[src]
F: Fn(&Ms) + 'static,
Trait Implementations
impl<Ms: Clone, Mdl, ElC: ElContainer<Ms>> Clone for App<Ms, Mdl, ElC>
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<Ms: Clone + 'static, Mdl: 'static, ElC: ElContainer<Ms>> Debug for App<Ms, Mdl, ElC>
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
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> 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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,