title: Removing elements from a Vec based on some condition
body: <p>My code looks like this:</p>
  
  <pre><code>struct Bar {
      i: i32,
  }
  
  struct Foo {
      v: Vec&lt;Bar&gt;,
  }
  
  impl Foo {
      fn foo(&amp;mut self) {
          self.v.drain(self.v.iter().filter(|b| b.i &lt; 10));
      }
  }
  </code></pre>
  
  <p>Note that <code>Bar</code> is not allowed to be copied or cloned.</p>
  
  <p>I want to delete all <code>Bar</code>s that don't satisfy that condition. Initially I thought I could just iterate over them and call <code>remove</code> but I am not allowed to have two mutable borrows or one mutable borrow if there is an immutable borrow which makes total sense.</p>
  
  <p>I guess the easiest thing would be to just <code>clone</code>, <code>filter</code> and <code>collect</code>, but I am not allowed to clone or copy.</p>
  
  <p>How would I do this?</p>