Skip to main content

Model

Trait Model 

Source
pub trait Model:
    Send
    + Sync
    + Sized
    + 'static {
    // Required methods
    fn update(&mut self, msg: &dyn Msg) -> Cmd;
    fn view(&self) -> View;

    // Provided method
    fn init(&self) -> Cmd { ... }
}
Expand description

Model defines the application state machine according to The Elm Architecture in Bubble Tea v2.0.8.

Required Methods§

Source

fn update(&mut self, msg: &dyn Msg) -> Cmd

Update receives a message and returns an updated Model and optional command.

Source

fn view(&self) -> View

View renders the program’s UI as a declarative View struct.

Provided Methods§

Source

fn init(&self) -> Cmd

Init is called when the program starts, returning an optional initial command.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§