Now I use lowercase and underscores everywhere.
- 0 Posts
- 3 Comments
Joined 2 years ago
Cake day: July 10th, 2023
You are not logged in. If you use a Fediverse account that is able to follow users, you can follow this user.
livingcoder@programming.devto Rust@programming.dev•Patterns for Modeling Overlapping Variant Data in Rust2·2 months agoThis was a good blog post. I have started using approach #3 as well for just about every situation where I was originally planning on just using a enum type by itself. Inevitably I end up needing to apply shared state to all of my enums (create date, parent table ID, etc.) and this approach has really worked out very well. You can also add some convenience functions for returning if the kind is one of the variants (ex:
IsKeywordSearch
) to make if-statements easier to read (and a match on the type enum is overly verbose when you don’t need the properties contained within the enum itself).
This is what I need, an explicit reason that makes one choice better than another. If hyphens make for a smoother experience, then I’ll reconsider my default behavior.
Thanks for pointing out this benefit.