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

12. Data Implementation

Carlo Milanesi1 
(1)
Bergamo, Italy
 
In this chapter, you will learn:
  • How to know how many bytes of stack are taken by objects of various types

  • How to shorten the path to access functions declared in external modules

  • How bits are stored in primitive type objects

  • How to know where an object is stored in memory

  • Why padding can increase the size taken by some objects

  • How vectors are implemented

Discovering the Size of Objects

Given a source file, the Rust compiler is free to generate any machine code, as long as it behaves in the way specified by the language Rust for that source code.

Therefore, for example, given a variable, it is not defined ...

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.