Functional update syntax requires that all fields be visible, not just the fields that are explicitly named. Why is this? Should structs that mix public and private fields be avoided?
The RFC that added that restriction explains the motivation.
I imagine the non-availability of struct literal syntax is almost never the deciding factor on whether a field should be private or a struct be non_exhaustive
. Usually that's about preserving invariants and library flexibility.
2 Likes