Skip to content

Update 01-01 #96

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 11, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
150 changes: 61 additions & 89 deletions src/ch01-01-installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,27 @@ command line tool for managing Rust versions and associated tools. You’ll need
an internet connection for the download.
-->

最初の手順は、Rustをインストールすることです。Rustは、`rustup`というRustのバージョンと関連するツールを管理するコマンドラインツールを使用して、
ダウンロードします。ダウンロードするには、インターネット接続が必要でしょう。
最初の手順は、Rustをインストールすることです。Rustは、Rustのバージョンと関連するツールを管理する、`rustup`というコマンドラインツールを使用してダウンロードします。ダウンロードするには、インターネット接続が必要でしょう。

<!--
> Note: If you prefer not to use `rustup` for some reason, please see [the Rust
> installation page](https://www.rust-lang.org/install.html) for other options.
> installation page](https://www.rust-lang.org/tools/install) for other options.
-->

> 注釈: なんらかの理由で`rustup`を使用しないことを好むのなら、[Rustインストールページ](https://www.rust-lang.org/install.html)で、
> 注釈: なんらかの理由で`rustup`を使用したくない場合、[Rustインストールページ](https://www.rust-lang.org/tools/install)で、
> 他の選択肢をご覧になってください。

<!--
The following steps install the latest stable version of the Rust compiler. All
the examples and output in this book use stable Rust 1.21.0. Rust’s stability
guarantees ensure that all the examples in the book that compile will continue
to compile with newer Rust versions. The output might differ slightly between
versions, because Rust often improves error messages and warnings. In other
words, any newer, stable version of Rust you install using these steps should
work as expected with the content of this book.
The following steps install the latest stable version of the Rust compiler.
Rust’s stability guarantees ensure that all the examples in the book that
compile will continue to compile with newer Rust versions. The output might
differ slightly between versions, because Rust often improves error messages
and warnings. In other words, any newer, stable version of Rust you install
using these steps should work as expected with the content of this book.
-->

以下の手順で最新の安定版のRustコンパイラをインストールします。この本の例と出力は全て、安定版のRust1.21.0を使用しています。
Rustの安定性保証により、現在この本の例でコンパイルできるものは、新しいバージョンになってもコンパイルでき続けることを保証します
以下の手順で最新の安定版のRustコンパイラをインストールします。
Rustは安定性 (stability) を保証しているので、現在この本の例でコンパイルできるものは、新しいバージョンになってもコンパイルでき続けることが保証されます
出力は、バージョンによって多少異なる可能性があります。Rustは頻繁にエラーメッセージと警告を改善しているからです。
言い換えると、どんな新しいバージョンでもこの手順に従ってインストールした安定版なら、
この本の内容で想定通りに動くはずです。
Expand All @@ -43,16 +41,16 @@ Rustの安定性保証により、現在この本の例でコンパイルでき
> In this chapter and throughout the book, we’ll show some commands used in the
> terminal. Lines that you should enter in a terminal all start with `$`. You
> don’t need to type in the `$` character; it indicates the start of each
> command. Lines that don't start with `$` typically show the output of the
> command. Lines that dont start with `$` typically show the output of the
> previous command. Additionally, PowerShell-specific examples will use `>`
> rather than `$`.
-->

> ### コマンドライン表記
> ### コマンドラインの記法
>
> この章及び、本を通して、端末で使用するなんらかのコマンドを示すことがあります。読者が入力するべき行は、
> 全て`$`で始まります。`$`文字を入れる必要はありません; 各コマンドの開始を示しているだけです
> `$`で始まらない行は、典型的には直前のコマンドの出力を示します。また、PowerShell限定の例は
> 全て`$`で始まります。ただし、読者が`$`文字を入力する必要はありません; これは各コマンドの開始を示しているだけです
> `$`で始まらない行は、典型的には直前のコマンドの出力を示します。また、PowerShell限定の例には
> `$`ではなく、`>`を使用します。

<!--
Expand All @@ -65,10 +63,10 @@ Rustの安定性保証により、現在この本の例でコンパイルでき
If you’re using Linux or macOS, open a terminal and enter the following command:
-->

LinuxかmacOSを使用しているなら、端末を開き、以下のコマンドを入力してください:
LinuxかmacOSを使用しているなら、端末(ターミナル)を開き、以下のコマンドを入力してください:

```text
$ curl https://sh.rustup.rs -sSf | sh
```console
$ curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh
```

<!--
Expand All @@ -84,37 +82,6 @@ for your password. If the install is successful, the following line will appear:
Rust is installed now. Great!
```

<!--
If you prefer, feel free to download the script and inspect it before running
it.
-->

お好みでご自由にスクリプトをダウンロードし、実行前に調査することもできます。

<!--
The installation script automatically adds Rust to your system PATH after your
next login. If you want to start using Rust right away instead of restarting
your terminal, run the following command in your shell to add Rust to your
system PATH manually:
-->

インストールスクリプトは、次回のログイン後にRustをシステムのPATHに自動的に追加します。端末を再起動するのではなく、
いますぐにRustを使用し始めたいのなら、シェルで以下のコマンドを実行してRustをシステムのPATHに手動で追加します:

```text
$ source $HOME/.cargo/env
```

<!--
Alternatively, you can add the following line to your *~/.bash_profile*:
-->

また、以下の行を *~/.bash_profile*に追加することもできます:

```text
$ export PATH="$HOME/.cargo/bin:$PATH"
```

<!--
Additionally, you’ll need a linker of some kind. It’s likely one is already
installed, but when you try to compile a Rust program and get errors indicating
Expand All @@ -125,44 +92,48 @@ compiler. Also, some common Rust packages depend on C code and will need a C
compiler. Therefore, it might be worth installing one now.
-->

さらに、なんらかの類のリンカが必要になるでしょう。既にインストールされている可能性が高いものの
Rustプログラムのコンパイルを試みて、リンカが実行できないというエラーが出たら、
これに加えて、なんらかのリンカが必要になるでしょう。既にインストールされている可能性は高いものの
Rustプログラムをコンパイルしようとした時、リンカが実行できないというエラーが出たら、
システムにリンカがインストールされていないということなので、手動でインストールする必要があるでしょう。
Cコンパイラは通常正しいリンカとセットになっています。
自分のプラットフォームのドキュメンテーションを見てCコンパイラのインストール方法を確認してください。
一般的なRustパッケージの中には、Cコードに依存し、Cコンパイラが必要になるものもあります。
故に今インストールする価値はあるかもしれません
ですので、Cコンパイラは今のうちにインストールしておく価値があるかもしれません

<!--
### Installing `rustup` on Windows
-->

### Windowsで`rustup`をインストールする


<!--
On Windows, go to [https://www.rust-lang.org/install.html][install] and follow
On Windows, go to [https://www.rust-lang.org/tools/install][install] and follow
the instructions for installing Rust. At some point in the installation, you’ll
receive a message explaining that you’ll also need the C++ build tools for
Visual Studio 2013 or later. The easiest way to acquire the build tools is to
install [Build Tools for Visual Studio 2017][visualstudio]. The tools are in
the Other Tools and Frameworks section.
install [Build Tools for Visual Studio 2019][visualstudio]. When asked which
workloads to install make sure "C++ build tools" is selected and that the Windows 10 SDK and the English language pack components are included.

-->

Windowsでは、[https://www.rust-lang.org/install.html][install]に行き、手順に従ってRustをインストールしてください。
インストールの途中で、Visual Studio2013以降用のC++ビルドツールも必要になるという旨のメッセージが出るでしょう。
ビルドツールを取得する最も簡単な方法は、[Visual Studio 2017用のビルドツール][visualstudio]をインストールすることです。
ツールは、他のツール及びフレームワークのセクションにあります。
Windowsでは、[https://www.rust-lang.org/tools/install][install]に行き、手順に従ってRustをインストールしてください。
インストールの途中で、Visual Studio 2013以降用のC++ビルドツールも必要になるという旨のメッセージが出るでしょう。
ビルドツールを取得する最も簡単な方法は、[Visual Studio 2019用のビルドツール][visualstudio]をインストールすることです。
どのワークロード (workloads) をインストールするかと質問されたときは、"C++ build tools"が選択されており、Windows 10 SDKと英語の言語パック (English language pack) が含まれていることを確かめてください。

> 訳注:Windowsの言語を日本語にしている場合は言語パックのところで「日本語」が選択されており、そのままの設定でインストールしても基本的に問題ないはずです。しかし、サードパーティーのツールやライブラリの中には英語の言語パックを必要とするものがあるため、「日本語」に加えて「英語」も選択することをお勧めします。

[install]: https://www.rust-lang.org/install.html
[visualstudio]: https://www.visualstudio.com/downloads/
[install]: https://www.rust-lang.org/tools/install
[visualstudio]: https://visualstudio.microsoft.com/visual-cpp-build-tools/

<!--
The rest of this book uses commands that work in both *cmd.exe* and PowerShell.
If there are specific differences, we’ll explain which to use.
-->

これ以降、*cmd.exe*とPowerShellの両方で動くコマンドを使用します。
特定の違いがあったら、どちらを使用すべきか説明します。
特段の違いがあったら、どちらを使用すべきか説明します。

<!--
### Updating and Uninstalling
Expand All @@ -175,10 +146,10 @@ After you’ve installed Rust via `rustup`, updating to the latest version is
easy. From your shell, run the following update script:
-->

`rustup`経由でRustをインストールしたら、最新版への更新は、簡単になります。シェルから、
以下の更新スクリプトを実行してください:
`rustup`経由でRustをインストールしたなら、最新版へ更新するのは簡単です。
シェルから以下の更新スクリプトを実行してください:

```text
```console
$ rustup update
```

Expand All @@ -189,7 +160,7 @@ shell:

Rustと`rustup`をアンインストールするには、シェルから以下のアンインストールスクリプトを実行してください:

```text
```console
$ rustup self uninstall
```

Expand All @@ -206,7 +177,7 @@ line:

Rustが正常にインストールされているか確かめるには、シェルを開いて以下の行を入力してください:

```text
```console
$ rustc --version
```

Expand All @@ -225,30 +196,31 @@ rustc x.y.z (abcabcabc yyyy-mm-dd)
If you see this information, you have installed Rust successfully! If you don’t
see this information and you’re on Windows, check that Rust is in your `%PATH%`
system variable. If that’s all correct and Rust still isn’t working, there are
a number of places you can get help. The easiest is [the #rust IRC channel on
irc.mozilla.org][irc], which you can access through
[Mibbit][mibbit]. At that address you can chat with other Rustaceans (a silly
nickname we call ourselves) who can help you out. Other great resources include
[the Users forum][users] and [Stack Overflow][stackoverflow].
a number of places you can get help. The easiest is the #beginners channel on
[the official Rust Discord][discord]. There, you can chat with other Rustaceans
(a silly nickname we call ourselves) who can help you out. Other great
resources include [the Users forum][users] and [Stack Overflow][stackoverflow].
-->

この情報が見れたら、Rustのインストールに成功しました!この情報が出ず、Windowsを使っているなら、
Rustが`%PATH%`システム環境変数にあることを確認してください。全て正常で、それでもRustが動かないなら、
助力を得られる場所はたくさんあります。最も簡単なのが[irc.mozilla.orgの#rust IRCチャンネル][irc]で、
[Mibbit][mibbit]を通してアクセスできます。そのアドレスで、助けてくれる他のRustacean(自分たちを呼ぶバカなニックネーム)とチャットできます。
他の素晴らしいリソースには、[ユーザ・フォーラム][users]と[Stack Overflow][stackoverflow]が含まれます。
この情報が見られたなら、Rustのインストールに成功しています!この情報が出ず、Windowsを使っているなら、
Rustが`%PATH%`システム環境変数にあることを確認してください。これらが全て正常であるのに、それでもRustがうまく動かないなら、
助力を得られる場所はたくさんあります。最も簡単なのが[Rustの公式Discord][discord]の#beginnersチャンネルです。そのアドレスで、助けてくれる他のRustacean (Rustユーザが自分たちのことを呼ぶ、冗談めいたニックネーム) たちとチャットできます。
他にも、素晴らしいリソースとして[ユーザ・フォーラム][users]と[Stack Overflow][stackoverflow]が挙げられます。

> Rustacean: いらないかもしれない補足です。Rustaceanは公式にcrustaceans(甲殻類)から[来て][twitter]いるそうです
> そのため、Rustのマスコットは非公式らしいですが、[カニ][mascott]。上の会話でCの欠点を削ぎ落としているからcを省いてるの?みたいなことを聞いていますが、
> 訳注1:Rustaceanについて、いらないかもしれない補足です。[公式Twitter曰く、Rustaceanはcrustaceans(甲殻類)から来ている][twitter]そうです
> そのため、Rustのマスコットは(非公式らしいですが)[カニ][mascott]。上の会話でCの欠点を削ぎ落としているからcを省いてるの?みたいなことを聞いていますが、
> 違うそうです。検索したら、堅牢性が高いから甲殻類という意見もありますが、真偽は不明です。
> 明日使えるかもしれないトリビアでした。

[irc]: irc://irc.mozilla.org/#rust
[mibbit]: http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust
> 訳注2:上にある公式Discordは英語話者のコミュニティです。日本語話者のためのコミュニティが[slackにあり][slack_jp]、こちらでもRustaceanたちが活発に議論をしています。
> 公式Discord同様、初心者向けの#beginnersチャンネルが存在するので、気軽に質問してみてください。

[discord]: https://discord.gg/rust-lang
[users]: https://users.rust-lang.org/
[stackoverflow]: http://stackoverflow.com/questions/tagged/rust
[stackoverflow]: https://stackoverflow.com/questions/tagged/rust
[twitter]: https://mobile.twitter.com/rustlang/status/916284650674323457
[mascott]: https://www.slideshare.net/wolf-dog/ss-64026540
[slack_jp]: https://rust-jp.herokuapp.com/

<!--
### Local Documentation
Expand All @@ -257,12 +229,12 @@ Rustが`%PATH%`システム環境変数にあることを確認してくださ
### ローカルのドキュメンテーション

<!--
The installer also includes a copy of the documentation locally, so you can
read it offline. Run `rustup doc` to open the local documentation in your
browser.
The installation of Rust also includes a copy of the documentation locally, so
you can read it offline. Run `rustup doc` to open the local documentation in
your browser.
-->

インストーラは、ドキュメンテーションの複製もローカルに含んでいるので、オフラインで閲覧することができます
インストールされたRustには、ローカルに複製されたドキュメンテーションのコピーが含まれているので、これをオフラインで閲覧することができます
ブラウザでローカルのドキュメンテーションを開くには、`rustup doc`を実行してください。

<!--
Expand All @@ -271,4 +243,4 @@ sure what it does or how to use it, use the application programming interface
(API) documentation to find out!
-->

標準ライブラリにより型や関数が提供され、それがなんなのかや使用方法に確信が持てない度に、APIドキュメンテーションを使用して探してください
標準ライブラリにより提供される型や関数がなんなのかや、それをどう使えば良いのかがよくわからないときは、いつでもAPIのドキュメンテーションを検索してみてください