Skip to content

Commit 3e36eec

Browse files
committed
Rollup merge of #28679 - xaviershay:book-unit-example, r=steveklabnik
This was non-obvious to me: with no example, I assumed `Electron {}` and didn't know what else to try when it didn't work. The correct form is weird because it looks like you're assigning the struct name rather than an instance of the struct. r? @steveklabnik
2 parents 6633988 + 3885a81 commit 3e36eec

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/doc/trpl/structs.md

+2
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@ You can define a `struct` with no members at all:
184184

185185
```rust
186186
struct Electron;
187+
188+
let x = Electron;
187189
```
188190

189191
Such a `struct` is called ‘unit-like’ because it resembles the empty

0 commit comments

Comments
 (0)