O'Reilly logo

Mastering Rust by Vesa Kaihlavirta

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Exercises

  1. Extend the arena game by showing more information about all the characters in the main GET /game page.

Solution: Edit game.hbs and include the stats in the form:

       <form action="/attack/{{@key}}" method="POST">             {{name}} str: {{strength}} dex: {{dexterity}} hp: {{hitpoints}}                  <button></button>          </form> 
  1. The arena game loses all its state when the program is restarted. A typical way for a web application is to store all the state in a relational database. Think of other ways. What would be the simplest way? Implement it.

Solution: We could use Serde to save JSON for us. Derive serialize and deserialize for all the data you want ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required