title: How to make a vector of received size?
body: <p>I have a vector <code>data</code> with size unknown at compile time. I want to create a new vector of the exact that size. These variants don't work:</p>
  
  <pre><code>let size = data.len();
  
  let mut try1: Vec&lt;u32&gt; = vec![0 .. size]; //ah, you need compile-time constant
  let mut try2: Vec&lt;u32&gt; = Vec::new(size); //ah, there is no constructors with arguments
  </code></pre>
  
  <p>I'm a bit frustrated - there is no any information in Rust API, book, reference or rustbyexample.com about how to do such simple base task with vector.
  This solution works but I don't think it is good to do so, it is strange to generate elements one by one and I don't have need in any exact values of elements:</p>
  
  <pre><code>let mut temp: Vec&lt;u32&gt; = range(0u32, data.len() as u32).collect();
  </code></pre>