title: cannot borrow as mutable, as it is behind a `&` reference
body: <p>In order to get to know Rust a bit better, I am building a simple text editor and have the following structs:</p>
  
  <pre class="lang-rust prettyprint-override"><code>struct File {
      rows: Vec&lt;Row&gt;,
      filename: Option&lt;String&gt;
  }
  
  impl File {
      fn row(&amp;self, index: u16) -&gt; &amp;Row{
          &amp;self.rows[index as usize]
      }
  
  }
  
  struct Row {
      string: String,
  }
  
  struct EditorState {
      file: File,
  }
  </code></pre>
  
  <p>As you can see, I am keeping the state of an editor in a struct, which references the file, which contains a number of rows, which contains a string (Each of these structs has more fields, but I have removed the ones not relevant to the problem)</p>
  
  <p>Now I want to make my rows editable and added this:</p>
  
  <pre class="lang-rust prettyprint-override"><code>impl Row {
      fn insert(&amp;mut self, at: u16, c: char) {
          let at = at as usize;
          if at &gt;= self.string.len() {
              self.string.push(c);
          } else {
              self.string.insert(at, c)
          }
      }
  }
  </code></pre>
  
  <p>This is how I try to update the row:</p>
  
  <pre class="lang-rust prettyprint-override"><code>//In the actual functon, I am capturing the keypress,
  //get the correct row from the state and pass it and the pressed
  // char to row.insert
  fn update_row(mut state: &amp;mut EditorState)  {
  let row = &amp;state.file.row(0);
  row.insert(0, 'a');
  
  }
  </code></pre>
  
  <p>This fails to compile:</p>
  
  <pre><code>error[E0596]: cannot borrow `*row` as mutable, as it is behind a `&amp;` reference
  </code></pre>
  
  <p>From the error, I can see that the issue is that Row should be mutable so I can edit it (which makes sense, since I am mutating it's String). I can't figure out a) how to be able to mutate the string here, and b) how to do this without having <code>row</code> always return a mutable reference, as in all other cases, I am calling <code>row</code> to read a row, and not to write it.</p>