最近發(fā)現(xiàn)拉取 crates.io 倉庫代碼尤其慢,很多次超時(shí)導(dǎo)致引用庫沒法編譯腹暖。這里可以切到國內(nèi)鏡像,配置如下:
-
找到當(dāng)前用戶目錄下 /Users/baoyachi/.cargo/ 的.cargo 文件夾靴拱,進(jìn)入.cargo 當(dāng)前目錄酒贬,在當(dāng)前目下創(chuàng)建 config 文件 ,見下圖虾啦,打開 config 文件麻诀,編寫以下內(nèi)容:
[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"
1521453334971.jpg