rust install - Forest0923/memo GitHub Wiki
Installation
- Access to Install Rust.
- You will get command below, if you use linux or Mac.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
- The command above create
/home/username/.cargo/
and you can use rust by adding path of $HOME/.cargo/bin
to $PATH.
rustup
rustup update
rustup self update
rustup self uninstall
cargo
- Create new project (executable):
cargo new dir_name --bin
cargo new dir_name --lib
- By default, cargo add .git/ and .gitignore. If you don't want to use VCS:
cargo new dir_name --bin --vcs none
- If you want to use other VCS, you can use the following command:
cargo new dir_name --bin --vcs hg
cargo new dir_name --bin --vcs pijul
cargo new dir_name --bin --vcs fossil
cargo build # create executable file
cargo check # don't create executable file
cargo run
rustup run nightly cargo run
rustc
rustc
is a Rust compiler. This is enough if the source code is small like hello world
.
rustc main.rs
./main
rustfmt
rustfmt
formats source code.
rustfmt main.rs