Skip to content

Commit

Permalink
Merge pull request #1645 from h-h-h-h/patch-1
Browse files Browse the repository at this point in the history
Update enum.md
  • Loading branch information
marioidival authored Dec 21, 2022
2 parents 251eeb2 + 417ad75 commit ccc5c70
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/custom_types/enum.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Enums

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

```rust,editable
Expand All @@ -10,7 +10,7 @@ an `enum`.
// `PageLoad != PageUnload` and `KeyPress(char) != Paste(String)`.
// Each is different and independent.
enum WebEvent {
// An `enum` may either be `unit-like`,
// An `enum` variant may either be `unit-like`,
PageLoad,
PageUnload,
// like tuple structs,
Expand All @@ -26,7 +26,7 @@ fn inspect(event: WebEvent) {
match event {
WebEvent::PageLoad => println!("page loaded"),
WebEvent::PageUnload => println!("page unloaded"),
// Destructure `c` from inside the `enum`.
// Destructure `c` from inside the `enum` variant.
WebEvent::KeyPress(c) => println!("pressed '{}'.", c),
WebEvent::Paste(s) => println!("pasted \"{}\".", s),
// Destructure `Click` into `x` and `y`.
Expand Down

0 comments on commit ccc5c70

Please sign in to comment.