pub trait AsyncComponentUpdate<ParentModel: Model>: Model {
    // Required methods
    fn init_model(parent_model: &ParentModel) -> Self;
    fn update<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        msg: Self::Msg,
        components: &'life1 Self::Components,
        sender: Sender<Self::Msg>,
        parent_sender: Sender<ParentModel::Msg>
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Available on crate feature tokio-rt only.
Expand description

ComponentUpdate for asynchronous workers and components.

Required Methods§

source

fn init_model(parent_model: &ParentModel) -> Self

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.

source

fn update<'life0, 'life1, 'async_trait>( &'life0 mut self, msg: Self::Msg, components: &'life1 Self::Components, sender: Sender<Self::Msg>, parent_sender: Sender<ParentModel::Msg> ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Update the model. The parent_sender allows to send messages to the parent.

Implementors§