pub trait Application: Sized + 'static {
type MSG;
// Required methods
fn update(&mut self, _msg: Self::MSG) -> Cmd<Self::MSG>;
fn view(&self) -> Node<Self::MSG>;
// Provided methods
fn init(&mut self) -> Cmd<Self::MSG> { ... }
fn stylesheet() -> Vec<String> { ... }
fn style(&self) -> Vec<String> { ... }
fn measurements(&mut self, _measurements: Measurements) { ... }
}
Expand description
An Application is the root component of your program. Everything that happens in your application is done here.
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn init(&mut self) -> Cmd<Self::MSG>
fn init(&mut self) -> Cmd<Self::MSG>
The application can implement this method where it can modify its initial state. This method is called right after the program is mounted into the DOM.
Sourcefn stylesheet() -> Vec<String>
fn stylesheet() -> Vec<String>
The css style for the application, will be mounted automatically by the program
Sourcefn style(&self) -> Vec<String>
fn style(&self) -> Vec<String>
dynamic style of an application which will be reinjected when the application style changed
Sourcefn measurements(&mut self, _measurements: Measurements)
fn measurements(&mut self, _measurements: Measurements)
This is called after dispatching and updating the dom for the component This is for diagnostic and performance measurement purposes.
Warning: DO NOT use for anything else other than the intended purpose
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.