pub trait AppUpdate: Model {
// Required method
fn update(
&mut self,
msg: Self::Msg,
components: &Self::Components,
sender: Sender<Self::Msg>
) -> bool;
}
Expand description
Define the behavior to update the model of the main app.
Example
impl AppUpdate for AppModel {
fn update(&mut self, msg: AppMsg, _components: &(), _sender: Sender<AppMsg>) -> bool {
match msg {
AppMsg::Increment => {
self.counter += 1;
}
AppMsg::Decrement => {
self.counter -= 1;
}
}
true
}
}