- cargo的依賴庫的默認源用的是https://crates.io/,但國內很多網絡訪問很慢
- 像python的pip和php的composer以及go都有國內的代理或鏡像
- rust國內也有鏡像源,中國科大的
- 設置cargo的國內鏡像源
- 在~/.cargo/目錄下,建一個config文件,windows下注意不要有擴展名
- 設置內容
[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 = "https://mirrors.ustc.edu.cn/crates.io-index"
#[http]
#check-revoke = false