環境構築
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
