Rust 开发环境

1. Overview

Windows WSL Container
开发环境(VS Code with Extension)

2. Windows

2.1. 安装

下载 rustup-init.exe,双击安装

2.2. 设置

使用 RsProxy 镜像源,编辑配置文件

1
2
3
4
5
6
7
8
9
10
11
12
Add-Content -Path $HOME\.cargo\config.toml -Value @'
[source.crates-io]
replace-with = 'rsproxy-sparse'
[source.rsproxy]
registry = "https://rsproxy.cn/crates.io-index"
[source.rsproxy-sparse]
registry = "sparse+https://rsproxy.cn/index/"
[registries.rsproxy]
index = "https://rsproxy.cn/crates.io-index"
[net]
git-fetch-with-cli = true
'@

3. WSL

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# install
export RUSTUP_DIST_SERVER="https://rsproxy.cn"
export RUSTUP_UPDATE_ROOT="https://rsproxy.cn/rustup"
curl --proto '=https' --tlsv1.2 -sSf https://rsproxy.cn/rustup-init.sh | sh

# config
cat > ~/.cargo/config.toml <<- 'EOM'
[source.crates-io]
replace-with = 'rsproxy-sparse'
[source.rsproxy]
registry = "https://rsproxy.cn/crates.io-index"
[source.rsproxy-sparse]
registry = "sparse+https://rsproxy.cn/index/"
[registries.rsproxy]
index = "https://rsproxy.cn/crates.io-index"
[net]
git-fetch-with-cli = true
EOM

4. Container

参考 项目模板Rust

作者

Michael Ding

发布于

2025-02-06

更新于

2025-02-06

许可协议