title: How do I set values of existing structs?
body: <p>Consider the following:</p>
  
  <pre><code>use rand::{thread_rng, Rng};
  
  struct Character {
      name: String,
      hp: i32,
      level: i32,
      xp: i32,
      gold: i32
  }
  
  impl Character {
      fn new(name: String) -&gt; Character {
          let mut rng = thread_rng();
  
          let hp: i32 = rng.gen_range(12, 75);
          let gold: i32 = rng.gen_range(10, 50);
  
          Character { name: name, hp: hp, level: 1, xp: 0, gold: gold }
      }
  
      fn set_hp(&amp;self, hp: &amp;i32) {
          &amp;self.hp = hp;
      }
  
      fn get_hp(&amp;self) -&gt; i32 {
          self.hp
      }
  }
  </code></pre>
  
  <p>Which generates the following error:</p>
  
  <pre class="lang-none prettyprint-override"><code>error[E0070]: invalid left-hand side expression
    --&gt; src/game/character/Character.rs:22:9
     |
  22 |         &amp;self.hp = hp;
     |         ^^^^^^^^^^^^^ left-hand of expression not valid
  </code></pre>
  
  <p>Why can I not set the <code>Character.hp</code> to the value passed in? What's this left hand expression jazz? I couldn't find any info on this in the docs.</p>