Skip to content

Commit 65aeb9e

Browse files
committed
v1.9の英文ドキュメントと差し替えた
1 parent f11b208 commit 65aeb9e

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

1.9/en/book/enums.md

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

3-
An `enum` in Rust is a type that represents data that could be one of
4-
several possible variants:
3+
An `enum` in Rust is a type that represents data that is one of
4+
several possible variants. Each variant in the `enum` can optionally
5+
have data associated with it:
56

67
```rust
78
enum Message {
@@ -12,9 +13,8 @@ enum Message {
1213
}
1314
```
1415

15-
Each variant can optionally have data associated with it. The syntax for
16-
defining variants resembles the syntaxes used to define structs: you can
17-
have variants with no data (like unit-like structs), variants with named
16+
The syntax for defining variants resembles the syntaxes used to define structs:
17+
you can have variants with no data (like unit-like structs), variants with named
1818
data, and variants with unnamed data (like tuple structs). Unlike
1919
separate struct definitions, however, an `enum` is a single type. A
2020
value of the enum can match any of the variants. For this reason, an
@@ -41,7 +41,7 @@ let y: BoardGameTurn = BoardGameTurn::Move { squares: 1 };
4141
Both variants are named `Move`, but since they’re scoped to the name of
4242
the enum, they can both be used without conflict.
4343

44-
A value of an enum type contains information about which variant it is,
44+
A value of an `enum` type contains information about which variant it is,
4545
in addition to any data associated with that variant. This is sometimes
4646
referred to as a ‘tagged union’, since the data includes a ‘tag’
4747
indicating what type it is. The compiler uses this information to
@@ -62,12 +62,11 @@ learn in the next section. We don’t know enough about Rust to implement
6262
equality yet, but we’ll find out in the [`traits`][traits] section.
6363

6464
[match]: match.html
65-
[if-let]: if-let.html
6665
[traits]: traits.html
6766

6867
# Constructors as functions
6968

70-
An enum’s constructors can also be used like functions. For example:
69+
An `enum` constructor can also be used like a function. For example:
7170

7271
```rust
7372
# enum Message {
@@ -76,7 +75,7 @@ An enum’s constructors can also be used like functions. For example:
7675
let m = Message::Write("Hello, world".to_string());
7776
```
7877

79-
Is the same as
78+
is the same as
8079

8180
```rust
8281
# enum Message {

0 commit comments

Comments
 (0)