#006
Jan 30, 2022
6. non-exhaustive enums
Use non-exhaustive attribute to indicate that enum may have more variants in future.
| |
If such enum is used in match pattern, it is required to handle ’_’ pattern.
| |
How is this useful?
If you are a maintainer of a library and you’d expect to add more variants in the future.
This approach helps you to build a library with non-breaking code changes for library users.