help: crates.io-index: add help on sparse index

This commit is contained in:
Zenithal 2023-02-08 13:59:51 +00:00
parent 7b54d52f54
commit 70fe609d21
No known key found for this signature in database
GPG Key ID: 1189C659F3D04C1C
2 changed files with 23 additions and 0 deletions

View File

@ -17,3 +17,5 @@ registry = "https://{{ site.hostname }}/git/crates.io-index.git"
```
该镜像可加快 cargo 读取软件包索引的速度。
在可能的情况下推荐使用 [Rust crates.io 稀疏索引镜像](/help/crates.io-index/)

View File

@ -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` 使用稀疏索引。