Taking Ownership with owned
Transfer a value into a function.
A Third Way to Pass
You have borrowed for reading and inout for editing. The third convention lets a function take over a value entirely. 📦
Meet owned
An owned argument transfers ownership into the function. The function now holds the value as its very own to use or store.
All lessons in this course
- Borrowing Arguments Read-Only
- Mutating in Place with inout
- Taking Ownership with owned
- The Transfer Operator