5 ms·
Thanks! Here are the reason why trait fields are preferable over accessors in case anyone else is wondering: 1. The borrow checker assumes accessors can do any
by whyever 10y ago
Thanks! Here are the reason why trait fields are preferable over accessors in case anyone else is wondering:
1. The borrow checker assumes accessors can do anything, freezing all other fields. This does not happen with trait fields.
2. Accessors have to use dynamic dispatch in case of trait objects, resulting in worse performance.