Re:Gnirehtet rewritten in Rust
by fnord123 on Monday September 25, 2017 @05:55AM
(#15329121)
Is the purpose of encapsulation to wrap all data fields in functions offering mutable references to data? I thought it was the exact opposite.
[ Parent
| on HN ]
The purpose was to show that something lifetime-bound to a part of a struct becomes lifetime-bound to the whole struct when returned from a function.
Using mutable references is the minimal way to get this.