April 2026
Intermediate
631 pages
16h 20m
English
A fundamental concept in Rust’s ownership system, borrowing allows multiple parts of a program to interact with data safely and efficiently. In simple terms, borrowing involves creating a reference to a value. A reference is similar to a pointer but comes with specific rules and limitations. Unlike ownership, references do not take ownership of the values they point to, which is why the process is called borrowing; a reference temporarily borrows a value without claiming ownership.
Borrowing involves many details and explicit rules that you must follow. In the following sections, we’ll explore several aspects of borrowing, starting with its rationale.
First, let’s discuss why borrowing is necessary. ...
Read now
Unlock full access