Rust(二)Cargo更换crates源

国内连接 cargo.io 太慢,修改 cargo 为国内源连接比较快。修改的方法是, 在 cd ~/.cargo ,然后 vim config, 在config文件中添加下面内容:

[source.crates-io]
replace-with = 'ustc'

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

如果所处环境不允许使用git协议,可以把上述地址改为:

 registry = "https://mirrors.ustc.edu.cn/crates.io-index"

发表评论