@@ -16,8 +16,7 @@ fundamentals.
16
16
実践的なプロジェクトに一緒に取り組むことで、Rustの世界に飛び込んでみましょう!
17
17
この章ではRustの一般的な概念を、実際のプログラムでの使い方を示しながら紹介します。
18
18
` let ` 、` match ` 、メソッド、関連関数、外部クレートの使用などについて学びます!
19
- 後続の章では、これらの概念をより詳しく掘り下げていきます。
20
- この章では基本的なことを練習します。
19
+ それらの詳細については後続の章で取り上げますので、この章では基礎部分だけを練習しましょう。
21
20
22
21
<!--
23
22
We’ll implement a classic beginner programming problem: a guessing game. Here’s
@@ -113,10 +112,10 @@ the next one.
113
112
-->
114
113
115
114
このゲーム(の開発)では各イテレーションを素早くテストしてから、次のイテレーションに移ります。
116
- ` run ` コマンドは、今回のようにイテレーションを素早く回したいときに便利です 。
115
+ ` run ` コマンドは、今回のようにプロジェクトのイテレーションを素早く回したいときに便利です 。
117
116
118
117
> 訳注:ここでのイテレーションは、アジャイル開発など、一連の工程を短期間で繰り返す開発手法で用いられている用語です。
119
- > イテレーションは、短い開発工程の 「一回のサイクル」のことです。
118
+ > イテレーションとは、開発工程の 「一回のサイクル」のことです。
120
119
>
121
120
> この章では「実装」→「テスト」のサイクルを繰り返すことで、プログラムに少しずつ機能を追加していきます。
122
121
@@ -273,10 +272,10 @@ detail in the [“Variables and Mutability”][variables-and-mutability] section
273
272
variable name:
274
273
-->
275
274
276
- この行では、 ` foo ` という名前の新しい変数を作成し、` bar ` の値に束縛しています 。
277
- Rustでは、変数は標準で不変( immutable) です。この概念について詳しくは、
278
- 第3章の「変数と可変性」節で議論します。以下の例には、
279
- 変数名の前に` mut ` をつけて変数を可変にする方法が示されています:
275
+ この行では` apples ` という名前の新しい変数を作成し、` 5 ` という値に束縛しています 。
276
+ Rustでは、変数は標準で不変( immutable) です。
277
+ この概念について詳しくは、 第3章の[ 「変数と可変性」] [ variables-and-mutability ] の節で議論します。
278
+ 以下の例には、 変数名の前に` mut ` をつけて変数を可変にする方法が示されています:
280
279
281
280
``` rust,ignore
282
281
let apples = 5; // immutable
@@ -868,13 +867,11 @@ has released the two new versions `0.8.4` and `0.9.0` you would see the
868
867
following if you ran `cargo update`:
869
868
-->
870
869
871
- クレートを* 本当に* アップグレードする必要が出てきたら、Cargoは別のコマンド(` update ` )を提供します。
872
- これは、* Cargo.lock* ファイルを無視して、* Cargo.toml* ファイル内の全ての指定に合致する最新バージョンを計算します。
873
- それがうまくいったら、Cargoはそれらのバージョンを* Cargo.lock* ファイルに記述します。
874
- しかし標準でCargoは、` 0.3.0 ` より大きく、` 0.4.0 ` 未満のバージョンのみを検索します。
875
- ` rand ` クレートの新バージョンが2つリリースされていたら(` 0.3.15 ` と` 0.4.0 ` だとします)、
876
- ` cargo update ` コマンドを走らせた時に以下のようなメッセージを目の当たりにするでしょう:
877
-
870
+ クレートを* 本当に* アップグレードしたくなったときのために、Cargoは` update ` コマンドを提供します。
871
+ このコマンドは、* Cargo.lock* ファイルを無視して、* Cargo.toml* ファイル内の全ての指定に適合する最新バージョンを算出します。
872
+ それがうまくいったら、Cargoはそれらのバージョンを* Cargo.lock* ファイルに記録します。
873
+ ただし、デフォルトでCargoは、` 0.8.3 ` 以上、` 0.9.0 ` 未満のバージョンのみを検索します。
874
+ もし` rand ` クレートの新しいバージョンとして` 0.8.4 ` と` 0.9.0 ` の二つがリリースされていたなら、` cargo update ` を実行したときに以下のようなメッセージが表示されるでしょう。
878
875
879
876
``` console
880
877
$ cargo update
@@ -892,10 +889,9 @@ the `0.9.x` series, you’d have to update the *Cargo.toml* file to look like
892
889
this instead:
893
890
-->
894
891
895
- この時点で、* Cargo.lock* ファイルに書かれている現在使用している` rand ` クレートのバージョンが、
896
- ` 0.3.15 ` になっていることにも気付くでしょう。
897
- ` rand ` のバージョン` 0.4.0 ` または、` 0.4.x ` シリーズのどれかを使用したかったら、
898
- 代わりに* Cargo.toml* ファイルを以下のように更新しなければならないでしょう:
892
+ Cargoは` 0.9.0 ` リリースを無視します。
893
+ またそのとき、* Cargo.lock* ファイルに、現在使用している` rand ` クレートのバージョンが` 0.8.4 ` であることを示す変更があることにも気づくでしょう。
894
+ そうではなく、` rand ` のバージョン` 0.9.0 ` または、` 0.9.x ` 系のどれかを使用するには、* Cargo.toml* ファイルを以下のように変更する必要があるでしょう。
899
895
900
896
``` toml
901
897
[dependencies ]
@@ -909,8 +905,7 @@ available and reevaluate your `rand` requirements according to the new version
909
905
you have specified.
910
906
-->
911
907
912
- 次回、` cargo build ` コマンドを走らせたら、Cargoは利用可能なクレートのレジストリを更新し、
913
- ` rand ` クレートの必要条件を指定した新しいバージョンに従って再評価します。
908
+ 次に` cargo build ` コマンドを実行したとき、Cargoは利用可能なクレートのレジストリを更新し、あなたが指定した新しいバージョンに従って` rand ` の要件を再評価します。
914
909
915
910
<!--
916
911
There’s a lot more to say about [Cargo][doccargo] and [its
@@ -1658,21 +1653,21 @@ discusses structs and method syntax, and Chapter 6 explains how enums work.
1658
1653
[parse]: ../std/primitive.str.html#method.parse
1659
1654
-->
1660
1655
1661
- [ prelude ] : .. /std/prelude/index.html
1662
- [ variables-and-mutability ] : ch03-01-variables-and-mutability.html#variables-and-mutability
1656
+ [ prelude ] : https://doc.rust-lang.org/stable /std/prelude/index.html
1657
+ [ variables-and-mutability ] : ch03-01-variables-and-mutability.html#変数と可変性
1663
1658
[ comments ] : ch03-04-comments.html
1664
- [ string ] : .. /std/string/struct.String.html
1665
- [ iostdin ] : .. /std/io/struct.Stdin.html
1666
- [ read_line ] : .. /std/io/struct.Stdin.html#method.read_line
1667
- [ ioresult ] : .. /std/io/type.Result.html
1668
- [ result ] : .. /std/result/enum.Result.html
1659
+ [ string ] : https://doc.rust-lang.org/stable /std/string/struct.String.html
1660
+ [ iostdin ] : https://doc.rust-lang.org/stable /std/io/struct.Stdin.html
1661
+ [ read_line ] : https://doc.rust-lang.org/stable /std/io/struct.Stdin.html#method.read_line
1662
+ [ ioresult ] : https://doc.rust-lang.org/stable /std/io/type.Result.html
1663
+ [ result ] : https://doc.rust-lang.org/stable /std/result/enum.Result.html
1669
1664
[ enums ] : ch06-00-enums.html
1670
- [ expect ] : .. /std/result/enum.Result.html#method.expect
1665
+ [ expect ] : https://doc.rust-lang.org/stable /std/result/enum.Result.html#method.expect
1671
1666
[ recover ] : ch09-02-recoverable-errors-with-result.html
1672
1667
[ randcrate ] : https://crates.io/crates/rand
1673
1668
[ semver ] : http://semver.org
1674
1669
[ cratesio ] : https://crates.io/
1675
1670
[ doccargo ] : http://doc.crates.io
1676
1671
[ doccratesio ] : http://doc.crates.io/crates-io.html
1677
1672
[ match ] : ch06-02-match.html
1678
- [ parse ] : .. /std/primitive.str.html#method.parse
1673
+ [ parse ] : https://doc.rust-lang.org/stable /std/primitive.str.html#method.parse
0 commit comments