使用旋武Rust基础设施
由于国内拉取 crates.io 以及安装 Rust 会面临流量出境不稳定的问题,我们提供了一个国内镜像代理以帮助国内 Rust 生态发展。
rustup 镜像
将下面的环境变量配置到您的 Shell rc 文件中(如 ~/.zshrc, ~/.bashrc 等,取决于您当前使用的 shell)。
Linux & MacOS
bash 配置:
bash
export RUSTUP_DIST_SERVER=https://xuanwu.base.atomgit.com
export RUSTUP_UPDATE_ROOT=https://xuanwu.base.atomgit.com/rustup
需要立即生效请执行 source ~/.zshrc
或 source ~/.bashrc
(取决于您当前使用的 shell)。
安装 Rust:
bash
curl --proto '=https' --tlsv1.2 -sSf https://xuanwu.base.atomgit.com/rustup-init.sh | sh
Windows
编辑环境变量,在环境变量中添加RUSTUP_DIST_SERVER
和RUSTUP_UPDATE_ROOT
。值为:
RUSTUP_DIST_SERVER=https://xuanwu.base.atomgit.com
RUSTUP_UPDATE_ROOT=https://xuanwu.base.atomgit.com/rustup
安装 Rust:
前往 Rust 安装页面 查看安装方法。
crates.io 镜像
编辑 ~/.cargo/config
文件,添加以下内容:
toml
[source.crates-io]
replace-with = 'xuanwu-sparse'
[source.xuanwu]
registry = "https://xuanwu.base.atomgit.com/crates.io-index"
[source.xuanwu-sparse]
registry = "sparse+https://xuanwu.base.atomgit.com/index/"
[registries.xuanwu]
index = "https://xuanwu.base.atomgit.com/crates.io-index"
[net]
git-fetch-with-cli = true