Skip to content

Commit

Permalink
Mention empty structs in tuple-structs.md
Browse files Browse the repository at this point in the history
  • Loading branch information
djmitche committed Jan 21, 2025
1 parent 3cca473 commit 38c3451
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/user-defined-types/tuple-structs.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ fn main() {
- Rust generally doesn’t like inexplicit things, like automatic unwrapping or
for instance using booleans as integers.
- Operator overloading is discussed on Day 3 (generics).
- When a tuple struct has zero fields, the `()` can be omitted. The result is a
zero-sized type (ZST), of which there is only one value (the name of the
type).
- This is common for types that implement some behavior but have no data
(imagine a `NullReader` that implements some reader behavior by always
returning EOF).
- The example is a subtle reference to the
[Mars Climate Orbiter](https://en.wikipedia.org/wiki/Mars_Climate_Orbiter)
failure.
Expand Down

0 comments on commit 38c3451

Please sign in to comment.