patterns
patterns copied to clipboard
Add "Destructure as a Reminder" idiom?
TL;DR:
// Destructure without `..` to cause a compile error when a new field is added.
// It will remind us to use the new field here.
let MyStruct { field1, field2 } = my_struct;
in a method that needs to handle every single field, including future ones.