diff --git a/help/_posts/1970-01-01-crates.io-index.git.md b/help/_posts/1970-01-01-crates.io-index.git.md index d6f87c1..9334db0 100644 --- a/help/_posts/1970-01-01-crates.io-index.git.md +++ b/help/_posts/1970-01-01-crates.io-index.git.md @@ -17,3 +17,5 @@ registry = "https://{{ site.hostname }}/git/crates.io-index.git" ``` 该镜像可加快 cargo 读取软件包索引的速度。 + +在可能的情况下推荐使用 [Rust crates.io 稀疏索引镜像](/help/crates.io-index/) diff --git a/help/_posts/2023-02-08-crates.io-index.md b/help/_posts/2023-02-08-crates.io-index.md new file mode 100644 index 0000000..48afc77 --- /dev/null +++ b/help/_posts/2023-02-08-crates.io-index.md @@ -0,0 +1,21 @@ +--- +category: help +layout: help +mirrorid: crates.io-index +--- + +## Rust crates.io 稀疏索引镜像使用帮助 + +编辑 `~/.cargo/config` 文件,添加以下内容: + +``` +[source.crates-io] +replace-with = 'tuna' + +[source.tuna] +registry = "sparse+https://{{ site.hostname }}/crates.io-index/" +``` + +注:`sparse+` 表示在使用稀疏索引,链接末尾的 `/` 不能缺少。 + +截至目前,可以通过 `cargo +nightly -Z sparse-registry update` 使用稀疏索引。