---
# System prepended metadata

title: Rust

---

# Rust

## install

[rustup](https://rustup.rs/#)

```shell=
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# RUSTUP_HOME
/Users/zhangxinhao/.rustup
# CARGO_HOME
/Users/zhangxinhao/.cargo
```

[Rustup 镜像](https://mirrors.tuna.tsinghua.edu.cn/help/rustup/)

```shell=
vi ~/.zshrc
export RUSTUP_DIST_SERVER=https://mirrors.tuna.tsinghua.edu.cn/rustup
export RUSTUP_UPDATE_ROOT=https://mirrors.tuna.tsinghua.edu.cn/rustup/rustup

# for bash
echo 'export RUSTUP_UPDATE_ROOT=https://mirrors.tuna.tsinghua.edu.cn/rustup/rustup' >> ~/.bash_profile
echo 'export RUSTUP_DIST_SERVER=https://mirrors.tuna.tsinghua.edu.cn/rustup' >> ~/.bash_profile
```

### windows

[从公司内源社区下载rust在windows上安装gnu版本方法](https://3ms.huawei.com/km/blogs/details/14298239)

[windows安装rust补充--安装rust前配置cntlm代理服务](https://3ms.huawei.com/km/groups/2025819/blogs/details/9306603)

```shell=
# cmd
set http_proxy=http://127.0.0.1:3128

# 查看已安装的 rust 工具链
rustup show
# 指定要使用的 rust 工具链
rustup default stable-x86_64-pc-windows-msvc
```

## study

[Rust半小时教程](https://colobu.com/2020/03/05/A-half-hour-to-learn-Rust/)

[Rust by Example](https://doc.rust-lang.org/rust-by-example/)

[通用软件开发demo](https://openx.huawei.com/communityHome/postDetail?postId=5701&id=90&source=openxAcSquare)

## IDE

[launch.json to debug Rust with VsCode](https://gist.github.com/xanathar/c7c83e6d53b72dd4464f695607012629)
