pub trait ComponentUpdate<ParentModel: Model>: Model {
    fn init_model(parent_model: &ParentModel) -> Self;
    fn update(
        &mut self,
        msg: Self::Msg,
        components: &Self::Components,
        sender: Sender<Self::Msg>,
        parent_sender: Sender<ParentModel::Msg>
    ); }
Expand description

Define the behavior to initialize and update a component or worker.

Required Methods

Initialize the model of the component or worker.

In case you want to share information or settings with the parent component you get the parent’s model passed as parameter.

Updates the model. Typically a match statement is used to process the message.

Components and sender don’t need to be used but help you sending messages to your components or queuing messages for self.

The parent sender allows to send messages to the parent component which for also can be the main app.