Open jalberse opened 8 months ago
For example, UVMapping has useful defaults (1, 1 for scaling and 0, 0 for offsets), so a struct initialization pattern with those being th edefaults, and users just specifying changes if they want, is likely better than a new() specifying all 4 values without defaults.
I tend to define a new() constructor pattern in many places, but I'm starting to think it's not the best fit in all situations. We might instead prefer to have plain struct initialization (which allows for some useful default syntax) or builder patterns.
I'd like to go through and examine struct initialization patterns in the code and clean them up if there's better approaches for each struct. I think it will vary on a case-by-case basis.
https://stackoverflow.com/questions/19650265/is-there-a-faster-shorter-way-to-initialize-variables-in-a-rust-struct https://xaeroxe.github.io/init-struct-pattern/