title: How do I transfer ownership of strings?
body: <p>I am new to Rust and have run into a problem similar to the following a few times:</p>
  
  <pre><code>fn main() {
      let mut as_str: Vec&lt;&amp;String&gt; = Vec::new();
      for i in [1, 2, 3, 4, 5].iter() {
          let i_str = i.to_string();
          as_str.push(&amp;i_str);
      }
  }
  </code></pre>
  
  <p>Which yields the following error:</p>
  
  <pre><code>&lt;anon&gt;:6:22: 6:27 error: `i_str` does not live long enough
  &lt;anon&gt;:6         as_str.push(&amp;i_str);
                            ^~~~~
  </code></pre>
  
  <p>How do I transfer ownership of the string to the vector (do not want to copy)?  Do I need a lifetime?  Should it be a str or a String (supposing I do not want to mutate the items themselves in the vector)?</p>