rust cargo指定国内镜像

参考
https://huangjj27.gitlab.io/posts/rust-mirror
https://doc.rust-lang.org/cargo/reference/source-replacement.html
https://lug.ustc.edu.cn/wiki/mirrors/help/rust-crates
https://github.com/rustcc/lernaean-deploy

在用户目录.cargo文件夹或在与Cargo.toml同级目录.cargo文件夹下创建config文件

[source.crates-io]
registry = "https://github.com/rust-lang/crates.io-index"
# 指定镜像
replace-with = 'sjtu'

# 清华大学
[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"

# rustcc社区
[source.rustcc]
registry = "https://code.aliyun.com/rustcc/crates.io-index.git"

挨个执行cargo build成功后即使用成功

你可能感兴趣的:(rust)