Installation, Updating, and Uninstalling
Linux or macOS
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
also for macOS
xcode-select --install
For Windows, go to https://www.rust-lang.org/tools/install and follow the instructions. You would also need to install MSVC build tools for Visual Studio from https://visualstudio.microsoft.com/downloads/. “Desktop Development with C++”, Windows 10/11 SDK, and your Language pack component.
Once Rust is installed you can check the rust version
rustc --version
Check cargo version
cargo --version
Updating to a newly released version
rustup update
Uninstalling Rust and rustup
rustup self uninstall
Open Rust local copy of the documentation
rustup doc
Creating and Running a New Project with Cargo
Create a new progject
cargo new hello_cargo
Cargo running a cargo project
cargo build
This command creates an executable file in target/debug/ so run the executable file from your terminal.
You can also run the command to run the project directory without producing a executable
cargo run
To quickly check if your code compiles
cargo check
To compile your project with optimization for release run the command
cargo build --release
learn more at https://doc.rust-lang.org/cargo