I am quite new to rust and am working on a small makrov chain cli. I am running into a problem with using structs, that contain a field: f32 in hashtables. Given a struct like this:
struct MyStruct {
field1: customType,
field2: f32,
field3: customType2,
}
I want to generate a hashmap like this:
{
(MyStruct, MyStruct): Vec<MyStruct>,
(MyStruct, MyStruct): Vec<MyStruct>,
}
To use a tuple of the struct as a key in the hashmap, I need to implement Eq and Hash for the struct and all custom types. Deriving these traits for my types fails because of the use of f32. What is the most sensible solution for this problem? Do I have to implement the traits for f32? All I could find on this where workarounds that where strongly discouraged.