crates.io源镜像

在构建应用时(cargo build)需要从crates下载,需要建立或修改~/.cargo/config文件指定国内镜像

环境变量

# windows
set RUSTUP_DIST_SERVER=https://rsproxy.cn
set RUSTUP_UPDATE_ROOT=https://rsproxy.cn/rustup

# linux
export RUSTUP_DIST_SERVER="https://rsproxy.cn"
export RUSTUP_UPDATE_ROOT="https://rsproxy.cn/rustup"

~/.cargo/config目前推荐 https://rsproxy.cn/

[source.crates-io]
replace-with = 'rsproxy'
[source.rsproxy]
registry = "https://rsproxy.cn/crates.io-index"
[source.rsproxy-sparse]
registry = "sparse+https://rsproxy.cn/index/"
[registries.rsproxy]
index = "https://rsproxy.cn/crates.io-index"
[net]
git-fetch-with-cli = true

其它源

[source.crates-io]
registry = "https://github.com/rust-lang/crates.io-index"
replace-with = 'rustcc'

[source.rustcc]
registry="git://crates.rustcc.com/crates.io-index"

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

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

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

[ 编辑 | 历史 ]
最近由“jilili”在“2024-03-09 02:15:56”修改