title: How do I clone a HashMap containing a boxed trait object?
body: <p>I have <code>HashMap</code> with custom hasher. Items of this <code>HashMap</code> without implemented trait <code>Clone</code> (it's a trait), but there is function to clone items like this:</p>
  
  <pre><code>use std::collections::HashMap;
  use std::hash::BuildHasherDefault;
  
  use fnv::FnvHasher;
  
  trait Item {
      fn get_id(&amp;self) -&gt; i32;
      fn cloned(&amp;self) -&gt; Box&lt;Item&gt;;
  }
  
  #[derive(Clone)]
  struct ItemImpl {
      id: i32,
      foo: i32
  }
  
  impl Item for ItemImpl {
      fn get_id(&amp;self) -&gt; i32 { self.id }
      fn cloned(&amp;self) -&gt; Box&lt;Item&gt; { Box::new(self.clone()) }
  }
  
  fn main() {
      let hash_map = HashMap::&lt;i32, Box&lt;Item&gt;, BuildHasherDefault&lt;FnvHasher&gt;&gt;::default();
  }
  </code></pre>
  
  <p>How I could clone <code>hash_map</code> shortly (in code) and efficiently (without creating a temporary collection)?</p>