I have a struct and a vector of them:
enum MySize {
Big,
Small,
Medium,
Huge,
}
struct MyStruct {
my_size: MySize,
field1: String,
field2: u64,
field3: f64,
}
let mut my_structs: Vec<MyStruct> = get_data_with_duplicates();
//how to remove duplicates from 'my_structs'?
I'm aware of sort_by
and dedup_by
, but I only know how to use them with the primitive types. In my case these methods can't be applied as are, right?
How to remove duplicates then?