Trait relm4::MicroModel

source ·
pub trait MicroModel {
    type Msg: 'static;
    type Widgets: MicroWidgets<Self> + Debug;
    type Data;

    // Required method
    fn update(
        &mut self,
        msg: Self::Msg,
        data: &Self::Data,
        sender: Sender<Self::Msg>
    );
}
Expand description

Trait that defines the types associated with model used by MicroComponent

It can be anything that stores application state.

Required Associated Types§

source

type Msg: 'static

The message type that defines the messages that can be sent to modify the model.

source

type Widgets: MicroWidgets<Self> + Debug

The widgets type that can initialize and update the GUI with the data the model provides.

If you don’t want any widgets (for example for defining a worker), just use () here.

source

type Data

Data that can be used to store senders and other stuff according to the needs of the user

Required Methods§

source

fn update( &mut self, msg: Self::Msg, data: &Self::Data, sender: Sender<Self::Msg> )

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

Implementors§