© Carlo Milanesi 2018
Carlo MilanesiBeginning Rusthttps://doi.org/10.1007/978-1-4842-3468-6_21

21. Drops, 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

  • Why custom destructors may be useful, and how to create them

  • 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, and how to specify that

  • Why some types need to be non-cloneable, and how to specify that

Deterministic Destruction

So far, ...

Get Beginning Rust: From Novice to Professional 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.