title: How to get & replace a value in Rust Vec?
body: <p>What I'm looking for is a replace method:</p>
  <blockquote>
  <pre class="lang-rust prettyprint-override"><code>pub fn replace(&amp;mut self, index: usize, element: T) -&gt; T
  </code></pre>
  <p>Replaces an element at position index within the vector and returns the existing value.</p>
  </blockquote>
  <p>Calling remove+insert seems wasteful to me.</p>