The Transfer Operator
Move values with the ^ sigil.
Move, Don't Copy
Passing to an owned parameter usually makes a copy. But if you are done with the original, copying is wasteful. You can move it instead. 🚚
Meet the Transfer Operator
Mojo's transfer operator is the caret ^ sigil. You place it after a value to hand its ownership over instead of duplicating it.
All lessons in this course
- Borrowing Arguments Read-Only
- Mutating in Place with inout
- Taking Ownership with owned
- The Transfer Operator