Similar to How to match struct fields in Rust?, is it possible to match a struct like Default without physically writing out the fields? I do not want to write out the fields constantly.
Something along the lines of:
let someValue = Struct { /* ... */ };
match someValue {
Struct::default() => println!("Default!"),
_ => println!("Not Default"),
}
This gives an error.
I did some testing on the Rust Playground but I only ended up running into the problem of matching named variables described in the docs.
What is your best solution to comparing many structs? Is it using #[derive(PartialEq)]
and if statements?