I'm fairly new to Rust and have been running into an issue with something I think should be simple so I'm likely doing something wrong.
I'm basically converting from &mut Vec to a HashSet back to a vector. Here's a sample of the code
fn remove_duplicates(nums: &mut Vec<i32>) -> i32 let x = HashSet::from_iter(nums).iter().collect::<Vec<i32>>();
And the error is :
| let x = HashSet::from_iter(nums).iter().collect::<Vec<i32>>(); | ^^^^^^^ value of type `Vec<i32>` cannot be built from `std::iter::Iterator<Item=&&mut i32>` | = help: the trait `FromIterator<&&mut i32>` is not implemented for `Vec<i32>`
Any idea if this is even possible or how I could go about mapping a HashSet to a Vector?