配置cargo国内源
https://mirrors.tuna.tsinghua.edu.cn/help/crates.io-index.git/
编辑 $CARGO_HOME/config 文件,添加以下内容:
[source.crates-io]
replace-with = 'mirror'
[source.mirror]
registry = "https://mirrors.tuna.tsinghua.edu.cn/git/crates.io-index.git"
注:$CARGO_HOME:在 Windows 系统默认为:%USERPROFILE%.cargo,在类 Unix 系统默认为:$HOME/.cargo
在 Linux 环境可以使用下面的命令完成:
mkdir -vp ${CARGO_HOME:-$HOME/.cargo}
cat << EOF | tee -a ${CARGO_HOME:-$HOME/.cargo}/config
[source.crates-io]
replace-with = 'mirror'
[source.mirror]
registry = "https://mirrors.tuna.tsinghua.edu.cn/git/crates.io-index.git"
EOF