[][src]Trait pixel_widgets::Model

pub trait Model: 'static {
    type Message;
    pub fn update(
        &mut self,
        message: Self::Message
    ) -> Vec<Command<Self::Message>>;
pub fn view(&mut self) -> Node<'_, Self::Message>; }

A model that keeps track of the state of your GUI. Serves to control the behaviour and DOM of your GUI. Styling is handled separately. Once you implemented a model, you can run your GUI using a Ui.

Examples

The examples in this repository all implement some kind of Model, check them out if you just want to read some code.

Associated Types

type Message[src]

The type of message your GUI will produce.

Loading content...

Required methods

pub fn update(&mut self, message: Self::Message) -> Vec<Command<Self::Message>>[src]

Called when a message is fired from the view or some other source. This is where you should update your gui state.

pub fn view(&mut self) -> Node<'_, Self::Message>[src]

Called after update or after the model has been accessed mutably from the Ui. This is where you should build all of your ui widgets based on the current gui state. The returned ui widgets produce messages of the type Self::Message.

Loading content...

Implementors

Loading content...