title: Rust unnecessary memory copy?
body: <p>In order to implement a iterator for a struct that has a slice with a lifetime, I had to do</p>
  <pre><code>
  struct S&lt;'a, T&gt; {
      inner: &amp;'a mut [T],
  }
  
  impl&lt;'a, T&gt; Iterator for S&lt;'a, T&gt; {
      type Item = &amp;'a mut T;
  
      fn next(&amp;mut self) -&gt; Option&lt;Self::Item&gt; {
          let temp = std::mem::take(&amp;mut self.inner);
          let (first, rest) = temp.split_first_mut()?;
          self.inner = rest;
          Some(first)
      }
  }
  </code></pre>
  <p>While writing this code, i realized lifetime enforces additional memory copy(mem::take) that would be unnecessary in C or C++. Am i missing something here or is this a small price that rust pays for the lifetime?</p>