実際のところ
$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
bashrcに以下の値を追加
source "$HOME/.cargo/env"
環境変数を再読込
$ exec $SHELL
動作確認
$ rustc --version rustc 1.82.0 (f6e511eec 2024-10-15)
個人的好みでベースになるプロジェクトフォルダを作成
$ mkdir rustsample $ cd rustsample
プロジェクト作成
今回用のテストプロジェクトを作成
$ cargo new grrs
Creating binary (application) `grrs` package
$ cd grrs
$ tree
.
├── Cargo.toml
└── src
└── main.rs
1 directory, 2 filesソースのmain.rsは、こんなん
ホントにhello, worldサンプル
fn main() { println!("Hello, world!"); }
実行
とりあえず実行
$ cargo run
Compiling grrs v0.1.0 (/home/ubuntu/rustsample/grrs)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.14s
Running `target/debug/grrs`
Hello, world!
ビルド
ビルドはこんなん
$ cargo run $ ./target/debug/grrs Hello, world!