Trait relm4::MicroWidgets

source ·
pub trait MicroWidgets<Model: MicroModel + ?Sized> {
    type Root: Debug;

    // Required methods
    fn init_view(model: &Model, sender: Sender<Model::Msg>) -> Self;
    fn view(&mut self, model: &Model, sender: Sender<Model::Msg>);
    fn root_widget(&self) -> Self::Root;
}
Expand description

Define behavior to turn the data of your MicroModel into widgets.

Required Associated Types§

source

type Root: Debug

The root represents the first widget that all other widgets of this MicroComponent are attached to.

Required Methods§

source

fn init_view(model: &Model, sender: Sender<Model::Msg>) -> Self

Initialize the UI.

Use the sender to connect UI events and send messages back to modify the model.

source

fn view(&mut self, model: &Model, sender: Sender<Model::Msg>)

Update the view to represent the updated model.

source

fn root_widget(&self) -> Self::Root

Return a clone of the root widget. This is typically a GTK4 widget.

Implementors§