In section 2.10, "Privacy for extensibility", are there any pros and cons to this approach over using the #[non_exhaustive] attribute? The latter works on both enums and structs, and doesn't require extra fields to be included.
Using private fields you can more precisely control the “private scope”. #[non_exhaustive] is “crate scoped”, it does not apply limits for use in the same crate.
Private fields are by default module scoped, and can be tweaked. So you can limit the use even in the same crate.
Private fields are by default module scoped, and can be tweaked. So you can limit the use even in the same crate.