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
sourceimpl<APP, MSG> Program<APP, MSG> where
MSG: 'static,
APP: 'static + Application<MSG>,
impl<APP, MSG> Program<APP, MSG> where
MSG: 'static,
APP: 'static + Application<MSG>,
sourcepub fn new(app: APP, root_node: &Node) -> Program<APP, MSG>
pub fn new(app: APP, root_node: &Node) -> Program<APP, MSG>
Create an Rc wrapped instance of program, initializing DomUpdater with the initial view and root node, but doesn’t mount it yet.
sourcepub fn replace_mount(app: APP, root_node: &Node) -> Program<APP, MSG>
pub fn replace_mount(app: APP, root_node: &Node) -> Program<APP, MSG>
Creates an Rc wrapped instance of Program and replace the root_node with the app view
sourcepub fn append_to_mount(app: APP, root_node: &Node) -> Program<APP, MSG>
pub fn append_to_mount(app: APP, root_node: &Node) -> Program<APP, MSG>
Instantiage an app and append the view to the root_node
sourcepub fn mount_to_body(app: APP) -> Program<APP, MSG>
pub fn mount_to_body(app: APP) -> Program<APP, MSG>
Instantiate the app and then append it to the document body
sourcepub fn replace_body(app: APP) -> Program<APP, MSG>
pub fn replace_body(app: APP) -> Program<APP, MSG>
Replace the body of the document with the app
Trait Implementations
sourceimpl<APP, MSG> Dispatch<MSG> for Program<APP, MSG> where
MSG: 'static,
APP: 'static + Application<MSG>,
impl<APP, MSG> Dispatch<MSG> for Program<APP, MSG> where
MSG: 'static,
APP: 'static + Application<MSG>,
This will be called when the actual event is triggered. Defined in the DomUpdater::create_closure_wrap function
sourcefn dispatch_multiple(&self, msgs: Vec<MSG, Global>)
fn dispatch_multiple(&self, msgs: Vec<MSG, Global>)
dispatch multiple msg
sourcefn dispatch(&self, msg: MSG)
fn dispatch(&self, msg: 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
impl<APP, MSG> !RefUnwindSafe for Program<APP, MSG>
impl<APP, MSG> !Send for Program<APP, MSG>
impl<APP, MSG> !Sync for Program<APP, MSG>
impl<APP, MSG> Unpin for Program<APP, MSG>
impl<APP, MSG> !UnwindSafe for Program<APP, MSG>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more