Rust Environment Setup
Rust supports many integrated development environments (IDEs) or text editors dedicated to development.
The tools officially announced as supported are as follows (https://www.rust-lang.org/zh-CN/tools):

This tutorial will use Visual Studio Code as our development environment (Eclipse has a version dedicated to Rust development, which is also a good choice for beginners).
**Note:** IntelliJ IDEA is hard to debug after installing plugins, so developers accustomed to IDEA are recommended to use CLion, but CLion is not free.
Setting Up the Visual Studio Code Development Environment
First, you need to install the latest version of the Rust compiler toolchain and Visual Studio Code.
Rust compiler toolchain:https://www.rust-lang.org/zh-CN/tools/install
Visual Studio Code:https://code.visualstudio.com/Download
Rust's compiler toolchain depends on a C compiler toolchain, which means your computer must already have at least one C compilation environment. If you are using Linux, you usually already have GCC or clang. If you are using macOS, you need to install Xcode. If you are using Windows, you need to install Visual Studio 2013 or above (with C/C++ support) to use MSVC, or install a MinGW + GCC compilation environment (Cygwin has not been tested).
Installing the Rust Compiler Toolchain
The Rust compiler toolchain can be downloaded from the official website: https://www.rust-lang.org/zh-CN/tools/install。
To download Rustup and install Rust on macOS, Linux, or other Unix-like systems, run the following command in a terminal:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
On Windows, download rustup-init.exe an executable file.
The downloaded Rustup on Windows is an executable program rustup-init.exe.
Now run the rustup-init file:

The figure above shows a command-line installation wizard.
If you have already installed MSVC (recommended), the installation process is very simple: enter 1 and press Enter to go directly to the second step.。
If you installed MinGW, you need to enter 2 (custom installation), and then the system will ask you "Default host triple?" Please take the default host triple "msvc" in the figure above and change it to "gnu", then enter the installer:

Leave all other properties at their defaults.
After setting all options, you will return to the installation wizard interface (the first figure), where you just enter 1 and press Enter.

Once you reach this step, the Rust installation is complete; you can test it with the following command:
rustc -V # 注意的大写的 V

If the two commands above can output the version number you installed, the installation was successful.
For more download methods, see:https://forge.rust-lang.org/infra/other-installation-methods.html
Setting Up the Visual Studio Code Development Environment
After downloading the Visual Studio Code installer, launch the installation wizard to install it (this step is not detailed here).
After installing Visual Studio Code (hereafter referred to as VSCode), run VSCode.

Find "Extensions" in the left sidebar, search for "Chinese", and install the Simplified Chinese extension to make the interface Chinese (if you prefer an English interface or your computer does not support Chinese characters, you can skip this step).

Install the rust-analyzer and Native Debug extensions in the same way.


Restart VSCode, and the Rust development environment is set up.
Now create a new folder, such as runoob-greeting.

Open the new folder in VSCode:

After opening the folder, select "Terminal" - "New Terminal" from the menu bar, and a new terminal will open:

Enter the command in the terminal:
cargo new greeting
A Rust project directory named greeting will be built under the current folder.

Now enter the following three commands in the terminal:
cd ./greeting
cargo build
cargo run
When creating the project, the system generates a Hello, world source program main.rs, which will then be compiled and run:

At this point, you have successfully built a Rust command-line program!
For issues about debugging programs in VSCode, see Cargo Tutorial。