borrowandlifetime
Borrow and lifetime is a term used to describe the core system in the Rust programming language that governs how references to data are used and how long those references remain valid. The goal is to enable memory safety without a garbage collector by enforcing rules at compile time.
Borrowing refers to taking a reference to a value without transferring ownership. There are two kinds of
Lifetimes are compile-time annotations that describe how long a reference is valid. They prevent dangling references
The interaction of borrows and lifetimes is enforced by the borrow checker, which operates on Rust’s ownership