Lộ trình học

Ownership và borrowing

Move, tham chiếu, slice, lifetime và con trỏ thông minh: những ý tưởng giúp Rust an toàn bộ nhớ mà không cần bộ thu gom rác.

5 bài học · 7 thử thách

  1. Bài học 1 thử thách Ownership and Moves Learn the rule behind Rust's memory safety: every value has one owner.
  2. Bài học 2 thử thách References and Borrowing Let a function use a value without taking ownership of it.
  3. Bài học 2 thử thách Slices Borrow part of a string or array without copying it.
  4. Bài học 1 thử thách Lifetimes Tell the compiler how long references stay valid with lifetime annotations.
  5. Bài học 1 thử thách Smart Pointers: Box and Rc Put data on the heap with Box and share ownership with Rc.