© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2022
C. MilanesiBeginning Rusthttps://doi.org/10.1007/978-1-4842-7208-4_23

23. Borrowing and Lifetimes

Carlo Milanesi1  
(1)
Bergamo, Italy
 
In this chapter, you will learn:
  • The typical programming errors concerning references, which Rust helps to avoid: use after move, use after drop, and use after change by an alias

  • The concept of borrowing of Rust references

  • The concept of lifetime of Rust objects and references

  • How Rust helps to avoid use after drop errors

  • How Rust, with its borrow checker, helps to avoid use after change by an alias errors

  • Why functions returning references need lifetime specifiers

  • How to use lifetime specifiers for functions, and what they mean

  • Why ...

Get Beginning Rust: Get Started with Rust 2021 Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.