Skip to content

Commit 417ad75

Browse files
authored
Update enum.md
Distinguish better between enums and enum variants. The first sentence I changed at first confused me, until I understood that its imprecise.
1 parent 687a1c3 commit 417ad75

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/custom_types/enum.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Enums
22

33
The `enum` keyword allows the creation of a type which may be one of a few
4-
different variants. Any variant which is valid as a `struct` is also valid as
4+
different variants. Any variant which is valid as a `struct` is also valid in
55
an `enum`.
66

77
```rust,editable
@@ -10,7 +10,7 @@ an `enum`.
1010
// `PageLoad != PageUnload` and `KeyPress(char) != Paste(String)`.
1111
// Each is different and independent.
1212
enum WebEvent {
13-
// An `enum` may either be `unit-like`,
13+
// An `enum` variant may either be `unit-like`,
1414
PageLoad,
1515
PageUnload,
1616
// like tuple structs,
@@ -26,7 +26,7 @@ fn inspect(event: WebEvent) {
2626
match event {
2727
WebEvent::PageLoad => println!("page loaded"),
2828
WebEvent::PageUnload => println!("page unloaded"),
29-
// Destructure `c` from inside the `enum`.
29+
// Destructure `c` from inside the `enum` variant.
3030
WebEvent::KeyPress(c) => println!("pressed '{}'.", c),
3131
WebEvent::Paste(s) => println!("pasted \"{}\".", s),
3232
// Destructure `Click` into `x` and `y`.

0 commit comments

Comments
 (0)