Rust TutorialLesson 20Free preview
Rust Ownership
This lesson is part of Rust · All levels
Summary
This lesson reviews the most fundamental core concept in Rust language, which is Ownership. Each value in Rust has only one owner variable at a time. When the owner moves, the old owner is no longer accessible, thus preventing double-free error.
Key points
- Every value in Rust has one variable owner.
- There can only be one owner at a time.
- When the owner is out of scope, the value will be automatically cleared.
- Setting a heap-type variable to another variable moving ownership, not copying
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.