Skip to Content
Rust in Action
book

Rust in Action

by Tim McNamara
August 2021
Beginner to intermediate
456 pages
12h 24m
English
Manning Publications
Content preview from Rust in Action

4 Lifetimes, ownership, and borrowing

This chapter covers

  • Discovering what the term lifetime means in Rust programming
  • Working with the borrow checker rather than against it
  • Multiple tactics for dealing with issues when these crop up
  • Understanding the responsibilities of an owner
  • Learning how to borrow values that are owned elsewhere

This chapter explains one of the concepts that trip up most newcomers to Rust—its borrow checker. The borrow checker checks that all access to data is legal, which allows Rust to prevent safety issues. Learning how this works will, at the very least, speed up your development time by helping you avoid run-ins with the compiler. More significantly though, learning to work with the borrow checker allows you to ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Rust in Action

Rust in Action

Tim McNamara
Effective Rust

Effective Rust

David Drysdale
Command-Line Rust

Command-Line Rust

Ken Youens-Clark

Publisher Resources

ISBN: 9781617294556Supplemental ContentPublisher SupportOtherPublisher WebsiteSupplemental ContentErrata PagePurchase Link