title: How can I make only certain struct fields mutable?
body: <p>I have a struct:</p>
  
  <pre><code>pub struct Test {
      pub x: i32,
      pub y: i32,
  }
  </code></pre>
  
  <p>I'd like to have a function that mutates this — easy:</p>
  
  <pre><code>pub fn mutateit(&amp;mut self) {
      self.x += 1;
  }
  </code></pre>
  
  <p>This makes the entire struct mutable for the duration of the function call of <code>mutateit</code>, correct? I <em>only</em> want to mutate <code>x</code>, and I don't want to mutate <code>y</code>. Is there any way to just mutably borrow <code>x</code>?</p>