rust 更换国内源

crates.io 是rust生态中人们分享开源项包的网站,和Linux的软件管理工具一样,有外网下载速度慢甚至导致各种奇怪的失败的问题。需要换为国内镜像源。

在~/.cargo/下创建config文件,文件内容如下。

[source.crates-io]
registry = "https://github.com/rust-lang/crates.io-index"
replace-with = 'ustc'
[source.ustc]
registry = "https://mirrors.ustc.edu.cn/crates.io-index"
[http]
check-revoke = false

为什么这么配置可以参考The Cargo Book/Source Replacement.  

posted @ 2021-09-30 10:05  ZRHW菜鸟  阅读(2178)  评论(0编辑  收藏  举报