O'Reilly logo

Rust Essentials by Ivo Balbaert

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 6. Pointers and Memory Safety

This is probably the most important chapter of this book. Here, we describe in detail the unique way in which the Rust borrow-checker mechanism detects problems at compile time to prevent memory safety errors. This is fundamental to everything else in Rust as the language is focused on these concepts of ownership and borrowing. Some of the material has already been discussed earlier, but here, we will strengthen that foundation. We will cover the following topics:

  • Pointers and references
  • Ownership and borrowing
  • Boxes
  • Reference counting

Trying out and experimenting with the examples is the key here as there are many concepts that you may not be familiar with yet.

Pointers and references

The The stack and the heap ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required