1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-06-15 22:00:26 +02:00

Various small fixes (#1556)

Plus one more substantial comment on casting.
This commit is contained in:
Marshall Pierce
2023-12-05 16:06:42 -07:00
committed by GitHub
parent 8f9902cc3e
commit 6c5061bb90
16 changed files with 23 additions and 21 deletions

View File

@ -68,9 +68,6 @@ Key Points:
Rust has several optimizations it can employ to make enums take up less space.
* Niche optimization: Rust will merge unused bit patterns for the enum
discriminant.
* Null pointer optimization: For [some
types](https://doc.rust-lang.org/std/option/#representation), Rust guarantees
that `size_of::<T>()` equals `size_of::<Option<T>>()`.

View File

@ -51,6 +51,6 @@ Key Points:
* The next slide will introduce Tuple structs, used when the field names are not important.
* If you already have variables with the right names, then you can create the
struct using a shorthand.
* The syntax `..peter` allows us to copy the majority of the fields from the old struct without having to explicitly type it all out. It must always be the last element.
* The syntax `..avery` allows us to copy the majority of the fields from the old struct without having to explicitly type it all out. It must always be the last element.
</details>