Skip to content

Commit b33dfa9

Browse files
committed
Update enums.md to 1.9
1 parent 65aeb9e commit b33dfa9

File tree

2 files changed

+9
-68
lines changed

2 files changed

+9
-68
lines changed

1.9/ja/book/enums.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
% 列挙型
22
<!-- % Enums -->
33

4-
<!-- An `enum` in Rust is a type that represents data that could be one of
5-
several possible variants: -->
4+
<!-- An `enum` in Rust is a type that represents data that is one of
5+
several possible variants. Each variant in the `enum` can optionally
6+
have data associated with it: -->
67
Rustの `enum` は、いくつかのヴァリアントのうちからどれか一つをとるデータを表す型です。
8+
`enum` の各ヴァリアントは、それぞれ自身に関連するデータを持つこともできます。
79

810
```rust
911
enum Message {
@@ -14,15 +16,13 @@ enum Message {
1416
}
1517
```
1618

17-
<!-- Each variant can optionally have data associated with it. The syntax for
18-
defining variants resembles the syntaxes used to define structs: you can
19-
have variants with no data (like unit-like structs), variants with named
19+
<!-- The syntax for defining variants resembles the syntaxes used to define structs:
20+
you can have variants with no data (like unit-like structs), variants with named
2021
data, and variants with unnamed data (like tuple structs). Unlike
2122
separate struct definitions, however, an `enum` is a single type. A
2223
value of the enum can match any of the variants. For this reason, an
2324
enum is sometimes called a ‘sum type’: the set of possible values of the
2425
enum is the sum of the sets of possible values for each variant. -->
25-
各ヴァリアントは、自身に関連するデータを持つこともできます。
2626
ヴァリアントの定義のための構文は、構造体を定義するのに使われる構文と似ており、
2727
(unit-like構造体のような) データを持たないヴァリアント、名前付きデータを持つヴァリアント、 (タプル構造体のような) 名前なしデータを持つヴァリアントがありえます。
2828
しかし、別々に構造体を定義する場合とは異なり、 `enum` は一つの型です。
@@ -54,7 +54,7 @@ let y: BoardGameTurn = BoardGameTurn::Move { squares: 1 };
5454
the enum, they can both be used without conflict. -->
5555
どちらのヴァリアントも `Move` という名前ですが、列挙型の名前でスコープ化されているため、衝突することなく使うことができます。
5656

57-
<!-- A value of an enum type contains information about which variant it is,
57+
<!-- A value of an `enum` type contains information about which variant it is,
5858
in addition to any data associated with that variant. This is sometimes
5959
referred to as a ‘tagged union’, since the data includes a ‘tag’
6060
indicating what type it is. The compiler uses this information to
@@ -85,13 +85,12 @@ equality yet, but we’ll find out in the [`traits`][traits] section. -->
8585
等値性を実装するにはRustについてまだ知るべきことがありますが、 [`トレイト`][traits] のセクションに書いてあります。
8686

8787
[match]: match.html
88-
[if-let]: if-let.html
8988
[traits]: traits.html
9089

9190
<!-- # Constructors as functions -->
9291
# 関数としてのコンストラクタ
9392

94-
<!-- An enum’s constructors can also be used like functions. For example: -->
93+
<!-- An `enum` constructor can also be used like a function. For example: -->
9594
列挙型のコンストラクタも、関数のように使うことができます。
9695
例えばこうです。
9796

@@ -102,7 +101,7 @@ equality yet, but we’ll find out in the [`traits`][traits] section. -->
102101
let m = Message::Write("Hello, world".to_string());
103102
```
104103

105-
<!-- Is the same as -->
104+
<!-- is the same as -->
106105
これは、以下と同じです。
107106

108107
```rust

diff-1.6.0..1.9.0/src/doc/book/enums.md

Lines changed: 0 additions & 58 deletions
This file was deleted.

0 commit comments

Comments
 (0)