title: How to loop over a vector of integers in Rust?
body: <p>I know the code below works:</p>
  <pre class="lang-rust prettyprint-override"><code>// method 1
  fn vec_loop(mut v: Vec&lt;i32&gt;) -&gt; Vec&lt;i32&gt; {
    v.iter().map(|x| x * 2).collect()
  }
  </code></pre>
  <p>However, I was wondering if it were possible to do it as such:</p>
  <pre class="lang-rust prettyprint-override"><code>// method 2
  fn vec_loop(mut v: Vec&lt;i32&gt;) -&gt; Vec&lt;i32&gt; {
    for i in v.iter_mut() {
      // TODO: Fill this up so that each element in the Vec `v` is multiplied by two.
    }
    v
  }
  </code></pre>
  <p>So far I've been unable to run the iteration using <code>iter_mut()</code>.I'd appreciate it if:</p>
  <ol>
  <li>Someone could shed light on how to run the code in this manner.</li>
  <li>Shed insight into whether or not there are any performance variations between method 1 and method 2.</li>
  </ol>