Widwos上にRust環境を構築する手順です
目次
インストールするもの
- Rust本体
- Microsoft C++ Build Tools
- Visual Studio Code(VS Code)
Rust本体は、Rust コンパイラ、ライブラリマネージャなどRustのコア機能一式となります
Microsoft C++ Build Toolsは実行可能ファイルを作成するために必要です。
Visual Studio Code(VS Code)はエディタです。
Rust本体のインストール
- rust のインストールサイト( https://www.rust-lang.org/ja/tools/install )へアクセスします。
- インストーラをダウンロードします。

- ダウンロードしたインストーラ(rustup-init.exe)をエクスプローラから起動します。
- コマンドプロンプト内でインストーラが動きます。表示が止まったら「1) Proceed with installation (default)」を指定します。
- インストーラが終了するまで待ちます。

以上でRust本体のインストールは完了です
Microsoft C++ Build Toolsのインストール
- 再びrust のインストールサイト( https://www.rust-lang.org/ja/tools/install )へアクセスします。
- 「Visual Studio C++ Build tools」のリンクをクリックします(下記画像参照)

- 「Build Tools のダウンロード」のリンクをクリックします(下記画像参照)

- ダウンロードした(vs_BuildTools.exe) インストーラをダブルクリックし起動します。
- インストーラ開始のウインドウがひらいたら「続行(C)」をクリックします。(下記画像参照)
- 続行をすると下記のような画面が表示される。
- 左上の「C++によるデスクトップ開発」をセレクトします。(下記画像の①)
- 右下の「インストール」をクリックします。(下記画像②)
- インストールが終了するまで待ちます。

- すでに Build Tools がインストール済みの環境では、左図のようなウインドウが開くことがあります。t特に支障がなければ「更新」しておいてください。

以上で、Microsoft C++ Build Tools のインストールは終了です。
Visual Studio Code のインストール
Visual Studio Code本体のインストール
- VS Code のインストールサイト(https://azure.microsoft.com/ja-jp/products/visual-studio-code/) アクセスしますにアクセスします。「vscode」 で Google検索すると最上位に出てくるサイトです
- 「Download Now」をクリックします。

- 「Windows」をクリックします。インストーラのダウンロードが始まります。

- ダウンロードしたインストーラをダブルクリックし起動します。
- 使用許諾に「同意する」を選択して「次へ(N)」を選択します。

- 確認画面がいくつか続きますが、特に問題がなければ、そのまま「次へ(N)」をクリックします。
- 「インストール」をクリックするとインストールが開始します。

- インストールが完了画面が表示されます。
- 引き続き拡張機能のインストールを行います。「Visual Studio Codeを実行する」チェックされているのを確認して「完了」をクリックします。

Rust 拡張機能 rust-analyzerのインストール
- VS Codeが起動します。
- 拡張機能のボタン(左辺にある正方形4つが積み重なっているアイコン)をクリック。(下記画像参照)

- Rust用の拡張機能をインストールします。
- 左上の方にある検索窓に rust-analyzer と入力してください。
- 見つかった rust-analyzer の「install」ボタンをクリックしてください。
※) rust-analyzer よりダウンロード数が多い「Rust」が見つかるかもしれませんが、新しい拡張機能である rust-analyzer を推奨します。

デバッガのインストール
- デバッガが使えるよう、CodeLLDB拡張機能をインストールします。
- 14.左上の方にある検索窓に codelldb と入力してください。
- 見つかった CodeLLDB の「install」ボタンをクリックしてください。

メニューの日本語化
- メニューが日本語になるよう日本語拡張機能をインストールします。
- 左上の方にある検索窓に japanese と入力してください。
- 見つかった 「Japanese Language Pack for Visual Studio Code」 の「install」ボタンをクリックしてください。
- VSCode再起動後から日本語が有効になります。
以上で、インストール完了です