pub struct Program<APP, MSG> where
    MSG: 'static, 
{ pub app: Rc<RefCell<APP>>, pub dom_updater: Rc<RefCell<DomUpdater<MSG>>>, }
Expand description

Holds the user App and the dom updater This is passed into the event listener and the dispatch program will be called after the event is triggered.

Fields

app: Rc<RefCell<APP>>

holds the user application

dom_updater: Rc<RefCell<DomUpdater<MSG>>>

The dom_updater responsible to updating the actual document in the browser

Implementations

Create an Rc wrapped instance of program, initializing DomUpdater with the initial view and root node, but doesn’t mount it yet.

get the real DOM node where this app is mounted to.

return the node where the app is mounted into

Creates an Rc wrapped instance of Program and replace the root_node with the app view

Example
struct App{}
let mount = document().query_selector(".container").ok().flatten().unwrap();
Program::replace_mount(App{}, &mount);

Instantiage an app and append the view to the root_node

Example
struct App{}
let mount = document().query_selector("#app").ok().flatten().unwrap();
Program::append_to_mount(App{}, &mount);

Instantiate the app and then append it to the document body

Example
struct App{}
Program::mount_to_body(App{});

Do the actual mounting of the view to the specified mount node

explicity update the dom

update the attributes at the mounted element

Inject a style to the mount node

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

This will be called when the actual event is triggered. Defined in the DomUpdater::create_closure_wrap function

dispatch multiple msg

Executes the implementing dispatch function. In this case the implementation is the Program which is responsible for executing the update functions using the msg supplied. A new view will then be created and it will be diff to the previous view which will produce patches. These patched will then be applied to the browser DOM. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.