3 ms·
For those not familiar with ownership concepts, it does apply to many things beyond just memory management. Most obvious example of this is file handles. In pyt
by Too 4y ago
For those not familiar with ownership concepts, it does apply to many things beyond just memory management. Most obvious example of this is file handles. In python you have to close() them or scope within a context manager to auto close when the block exits. If you need more complex logic around, such as transfer the handle into another function, the context manager is no longer sufficient and you quickly loose track of who should call close(), is it the caller or the callee.
Rust keeps track of this, no matter how deep you twist your logic and it does so for every variable, no context manager blocks required.