環境構築
1. rustupのインストール
- https://www.rust-lang.org/ja/tools/install を開く
- 上記ページのシェルそのまま実行してrustupを入れる
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
- 選択肢は
Proceed with standard installation
で進む - ターミナル再起動
-
cargo
コマンドが動けばok
2. エディタ設定
- vscode開く
- 拡張機能
rust-analyzer
を入れる - clippyいれる
3. リポジトリ作成
-
cargo init rust_practice
(これで.git
込のpjが生成) cd rust_practice
-
cargo run
するとHello, world!
が表示される
hello world
-
cargo build
するとtarget/debug/rust_practice
が生成される(pj名と同じものが出来るのでrust_practice
となっている) -
target/debug/rust_practice
と直接バイナリ実行でもHello world!
ひょうじされr