3 ms·
This is pretty good. A useful way to think about this: - All data in Rust has exactly one owner. - If you need some kind of multiple ownership, you have to m
by Animats 2y ago
This is pretty good.
A useful way to think about this:
- All data in Rust has exactly one owner.
- If you need some kind of multiple ownership, you have to make the owner be a reference-counted cell, such as Rc or Arc.
- All data can be accessed by one reader/writer, or N readers, but not both at the same time.
- There is both compile time and run time machinery to strictly enforce this.
Once you get that, you can see what the borrow checker is trying to do for you.