title: Create a vector from iterating hashmap
body: <p>What is the optional way in Rust to iterate a <code>HashMap</code> and collect the result into a <code>Vec</code>? This is my attempt so far:</p>
  
  <pre><code>use std::collections::HashMap;
  
  struct User {
      reference: String,
      email: String
  }
  
  fn main() {
  
      let mut users: HashMap&lt;String, User&gt; = HashMap::new();
      users.insert("first".to_string(), User { reference: "ref1".to_string(), email: "test@test.com".to_string() });
      users.insert("second".to_string(), User { reference: "ref2".to_string(), email: "test1@test.com".to_string() });
      users.insert("third".to_string(), User { reference: "ref3".to_string(), email: "test3@test.com".to_string() });
  
      //this is my failed attempt
      let user_refs: Vec&lt;String&gt; = users.iter().map(|(_, user)| &amp;user.reference.clone()).collect();
  
  }
  </code></pre>
  
  <p>throws an error</p>
  
  <pre><code>src/main.rs:15:85: 15:94 error: the trait `core::iter::FromIterator&lt;&amp;collections::string::String&gt;` is not implemented for the type `collections::vec::Vec&lt;collections::string::String&gt;` [E0277]
  src/main.rs:15  let user_refs: Vec&lt;String&gt; = users.iter().map(|(_, user)| &amp;user.reference.clone()).collect();
                                                                                                     ^~~~~~~~~
  src/main.rs:15:85: 15:94 note: a collection of type `collections::vec::Vec&lt;collections::string::String&gt;` cannot be built from an iterator over elements of type `&amp;collections::string::String`
  src/main.rs:15  let user_refs: Vec&lt;String&gt; = users.iter().map(|(_, user)| &amp;user.reference.clone()).collect();
                                                                                                     ^~~~~~~~~
  error: aborting due to previous error
  </code></pre>