© 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_22

22. Ownership, Moves, and Copies

Carlo Milanesi1  
(1)
Bergamo, Italy
 
In this chapter, you will learn:
  • Why deterministic and implicit destruction of objects is a big plus of Rust

  • The concept of ownership of objects

  • The three kinds of assignment semantics: share semantics, copy semantics, and move semantics

  • Why implicit share semantics is bad for software correctness

  • Why move semantics may have better performance than copy semantics

  • Why some types need copy semantics and others do not

  • Why some types need to be noncloneable

  • How to specify that a type must use copy semantics

  • How to specify that a type ...

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.