When you define an enum, add
#[derive(PartialEq, Eq)]
enum Foo {…}
to make it work with `==`, e.g.
if foo_value == Foo::Variant {…
@wzhd Floating-point NaN is weird in that NaN != NaN. Rust has PartialEq too express this. Eq is the usual ==, but it inherits from PartialEq, so you need both.
@rust oh right, when a trait inherits another trait, both have to be implemented (or derived). Thank you so much for tips!
@rust why both PartialEq and Eq? I haven't quite grasped it yet