Tuple struct with a single field to make an opaque wrapper for the type.
Example:
struct Password(String);Motivation:
- share implementation details between types while controlling interface
- allow backward compatible changes -> promise less, break less
- distinguish units
- implementing foreign traits on foreign types
References
- J. Gjengset, Rust for Rustaceans: Idiomatic Programming for Experienced Developers. No Starch Press, 2021.
- https://rust-unofficial.github.io/patterns/patterns/behavioural/newtype.html