Skip to main content

update

Function update 

Source
pub fn update(app: &mut App, msg: Message) -> Cmd
Expand description

Apply a message to the application state and return any commands (async side-effects) to execute.

This is the core TEA update function — a pure state transition. It never performs I/O directly; instead it returns Cmd values that the runtime executes asynchronously.

§Examples

use remendo::app::App;
use remendo::config::Config;
use remendo::update::{update, Message};
use remendo::cmd::Cmd;
use remendo::app::RunningState;

let mut app = App::new(Config::default());
let cmd = update(&mut app, Message::Quit);
assert_eq!(app.running_state, RunningState::Done);
assert!(matches!(cmd, Cmd::None));