เส้นทางการเรียนรู้

Ownership และ Borrowing

การ move, reference, slice, lifetime และ smart pointer: แนวคิดที่ทำให้ Rust ปลอดภัยด้านหน่วยความจำโดยไม่ต้องมี garbage collector

บทเรียน 5 บท · โจทย์ 7 ข้อ

  1. บทเรียน โจทย์ 1 ข้อ Ownership and Moves Learn the rule behind Rust's memory safety: every value has one owner.
  2. บทเรียน โจทย์ 2 ข้อ References and Borrowing Let a function use a value without taking ownership of it.
  3. บทเรียน โจทย์ 2 ข้อ Slices Borrow part of a string or array without copying it.
  4. บทเรียน โจทย์ 1 ข้อ Lifetimes Tell the compiler how long references stay valid with lifetime annotations.
  5. บทเรียน โจทย์ 1 ข้อ Smart Pointers: Box and Rc Put data on the heap with Box and share ownership with Rc.