1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-04-26 09:12:58 +02:00

Indent code in speaker notes (#476)

* Indent code in speaker notes

#475

* Update stack.md

* Update destructuring-arrays.md

* Update hashmap.md

* Update traits.md
This commit is contained in:
Charisee Chiw 2023-03-11 14:12:32 -08:00 committed by GitHub
parent 368f3ba302
commit 59d3d7f625
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 121 additions and 122 deletions

View File

@ -42,8 +42,7 @@ fn main() {
* Types that implement a given trait may be of different sizes. This makes it impossible to have things like `Vec<Greet>` in the example above.
* `dyn Greet` is a way to tell the compiler about a dynamically sized type that implements `Greet`.
* In the example, `pets` holds Fat Pointers to objects that implement `Greet`. The Fat Pointer consists of two components, a pointer to the actual object and a pointer to the virtual method table for the `Greet` implementation of that particular object.
Compare these outputs in the above example:
* Compare these outputs in the above example:
```rust,ignore
println!("{} {}", std::mem::size_of::<Dog>(), std::mem::size_of::<Cat>());
println!("{} {}", std::mem::size_of::<&Dog>(), std::mem::size_of::<&Cat>());