Architecture

Sauron programs always look something like this:

ModelHtmlviewupdateMsgevents

Sauron program produces html Node tree to show on the screen. Events are sent back as messages of what is going on. "They clicked a button!"

What happens within the sauron program through? It always breaks into 3 parts.

  • model - the state of you application
  • view - a way to turn your state into Html nodes.
  • update - a way to update your state based on messages.

Sauron provides Application trait which lets you implement a view and update of the Model of your application. These 3 methods are the core of sauron web framework.

The next few examples are going to show how to use this pattern for user input, like buttons and text fields. It will make this much more concrete!