0Pricing
Mojo Academy · Lesson

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

  1. Borrowing Arguments Read-Only
  2. Mutating in Place with inout
  3. Taking Ownership with owned
  4. The Transfer Operator
← Back to Mojo Academy