RustのインストールからCargoのプロジェクトを作って始める方法
Rustのインストール
公式にある以下のコマンドでインストールしたほうが良さそう。
code:bash
brewだとrustupがなかったりする。コマンドは以下の公式サイトに載っている。
https://gyazo.com/cfc7a8c57f8968f6d4fbc5c63b5c57ae
以下はインストール完了後のメッセージ。パス通したり、sourceしたりすべきことが書かれている。
code:インストール後のメッセージ
Rust is installed now. Great!
To get started you need Cargo's bin directory ($HOME/.cargo/bin) in your PATH
environment variable. Next time you log in this will be done automatically.
To configure your current shell run source $HOME/.cargo/env
以下でrustcとかcargoとか入る
(注意:以下よりは上記のcurlの方法が良い)
brew install rust
以下でcargoのプロジェクト作成。
code:bash
cargo new hello-world --bin
ビルドと実行
$ cargo build
$ ./target/debug/hello-world