I want to sort a vector of structs, by comparing several fields of the structs. Example:
my_vec.sort_unstable_by_key(|k| (k.a, k.b, k.c));
That looks perfect. However, types like f32 and f64 only implement PartialOrd and not Ord (due to their special NaN values). So if some of those fields in the structs are f64 for example, I cannot use the method above.
I know I can get the job done in several ways, but I'd like to know what would be the simplest solution for cases like this?