I want to build a HashSet from a Vec. I\'d like to do this
HashSet
Vec
Moving data ownership
let vec: Vec = vec![1, 2, 3, 4]; let hash_set: HashSet = vec.into_iter().collect();
Cloning data
let vec: Vec = vec![1, 2, 3, 4]; let hash_set: HashSet = vec.iter().cloned().collect();