Memory representation

Apart from managing the references, ownerships, allocations, and copies, we can also manage the memory layout of those structures we saw earlier, and we can do it by using both safe and unsafe code. Let's first understand how Rust manages the memory. Think of the following structure:

struct Complex {    attr1: u8,    attr2: u16,    attr3: u8,}

Get Rust High Performance 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.