ProgrammingAdvancedrust

Rust Fundamentals

Ownership, borrowing and lifetimes, learned the way the borrow checker expects.

Rust's borrow checker is not an obstacle to work around; it is the mechanism that lets the compiler guarantee memory safety with no garbage collector and no manual free. This course builds that intuition from first principles. You start with what a move actually is, why a value cannot be used after it, how shared and exclusive borrows are made exclusive at compile time, and how those same rules are what make Rust threads safe without locks you have to remember. Lifetimes get their own module because they are the one part of the system that look like types but cost nothing at runtime. By the end you should be able to read a borrow-checker error and name the rule it is enforcing, which is the difference between fighting the compiler and working with it.

4.8 (214) 680 students 207 min 21 lessons 280 XP on completion

What you will be able to do

  • Explain what a move does to the original binding and why the compiler forbids using it afterwards
  • Apply the two borrowing rules to decide between a shared reference, a mutable reference, and a clone
  • Read and write trait bounds, and tell static dispatch from dynamic dispatch
  • Propagate errors with Result and the ? operator instead of panicking
  • Annotate lifetimes to tie a returned reference to the input it borrows from
  • Share mutable state between threads with Arc and Mutex, and hand values across threads with channels

Assessments

Dashboard