3

install rust

 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Is Rust up to date?

Rust updates very frequently. If you have installed Rustup some time ago, chances are your Rust version is out of date. Get the latest version of Rust by running rustup update .

Reference article: Quickly set up a Rust development environment and write a small app!

rust There is no wall, the speed is still not good, use the following command to download and install

 RUSTUP_DIST_SERVER=https://mirrors.ustc.edu.cn/rust-static RUSTUP_UPDATE_ROOT=https://mirrors.ustc.edu.cn/rust-static/rustup curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup update command can help us upgrade the version of rust and toolchain online

Configure rust basic environment variables

Add the following to the environment variables file

 . "$HOME/.cargo/env"

Configure rustup mirroring

Before using rustup , set the environment variable RUSTUP_DIST_SERVER (for update toolchain ):

 export RUSTUP_DIST_SERVER=https://mirrors.ustc.edu.cn/rust-static

and RUSTUP_UPDATE_ROOT (for update rustup ):

 export RUSTUP_UPDATE_ROOT=https://mirrors.ustc.edu.cn/rust-static/rustup

Reference article: Rust Toolchain Reverse Proxy Help

Configure cargo environment variables

Add the following to $HOME/.cargo/config :

 [source.crates-io]
replace-with = 'ustc'

[source.ustc]
registry = "git://mirrors.ustc.edu.cn/crates.io-index"

Reference article: Help with Rust Crates Sources


Reference article: Install Rust development environment using domestic mirrors


Use vscode remote ssh remote editing rust code👇

图片.png

Use clion local edit rust code👇

图片.png

What is the relationship between rustc and rustup cargo? - LingerZ's answer - Knowing
https://www.zhihu.com/question/447011073/answer/1756560607

universe_king
3.4k 声望680 粉丝