美文网首页
【RUST】MAC 下 crates 国内镜像源配置

【RUST】MAC 下 crates 国内镜像源配置

作者: buddyCoder | 来源:发表于2019-03-28 00:10 被阅读0次

最近终于体验到拉取 crates.io 仓库代码尤其慢,很多次超时导致引用库没法编译。
记得在学习Rust的时候,国内是有镜像的。那么我们可以切到国内镜像,感谢中科大!
配置如下:
找到当前用户目录下 /Users/[youname]/.cargo/ 的.cargo 文件夹,进入.cargo 当前目录,在当前目下创建 config 文件 ,config文件是没有的。需要自己创建!!自己创建!!
接着在config里面写上

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

如果所处的环境中不允许使用 git 协议,可以把上述地址
registry = "git://mirrors.ustc.edu.cn/crates.io-index"
改为:
registry = "https://mirrors.ustc.edu.cn/crates.io-index"

相关文章

网友评论

      本文标题:【RUST】MAC 下 crates 国内镜像源配置

      本文链接:https://www.haomeiwen.com/subject/pmaxbqtx.html