Rust Notes — Module 2

Rust Notes — Module 2: Borrowing & References 1. The Problem Ownership Alone Creates If ownership always moves, passing values to functions becomes painful — you lose access to the value after the call: fn print_string(s: String) { println!("{}", s); } // s is dropped here fn main() { let s = String::from("hello"); print_string(s); // println!("{}", s); // ❌ s was moved into print_string, gone! } You’d have to clone everything or return ownership back — both are tedious. Borrowing solves this. ...

March 17, 2026 · 6 min