T:Copy, HashSet<T> to Vec<T>

  1. Suppose I do:
let v = hset.iter().collect::<Vec<_>>()

What this does is it takes a HashSet and produces a Vec<&T>

  1. Now, without consuming the HashSet, is it possible, via the Copy on T, to produce a Vec
let v = hset.iter().cloned().collect::<Vec<_>>()
1 Like