Application

A minimal sauron application only need to implement the Application trait.

1pub trait Application<MSG>{
2    fn update(&mut self, msg: MSG) -> Cmd<Self, MSG>;
3    fn view(&self) -> Node<MSG>;
4}
1impl Application<Msg> for Model {
2    fn update(&mut self, msg: MSG) -> Cmd<Self, MSG>{
3        // --snip--
4    }
5    fn view(&self) -> Node<MSG>{
6        // --snip
7    }
8}

There are only 2 methods that you are required to implement in an Application. The update function describes how it update the models based on the MSG that is coming from UI events. Update can return a Cmd which in turn further update the Application model in the subsequent update loop. The view function describes how to present the application in the screen.

Cmd

Sauron has a runtime system where it executes commands. A Cmd is a way of telling Sauron, "Hey, I want you to do this thing!". So if you want to send an HTTP request, you would need to command Sauron to do it.

Every Cmd specifis which effects you need to do the application and the type of messages that will come back into your application.