安装
在官网:RUSTUP-INIT下载rustup-init.exe
在下载好的目录打开一个powershell,运行:
$ENV:RUSTUP_DIST_SERVER='https://mirrors.ustc.edu.cn/rust-static'
$ENV:RUSTUP_UPDATE_ROOT='https://mirrors.ustc.edu.cn/rust-static/rustup'
接着在powershell打开rustup-init.exe
之后,根据以下输出进行配置。
Current installation options:
default host triple: x86_64-pc-windows-msvc
default toolchain: stable (default)
profile: default
modify PATH variable: yes
1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
>2
I'm going to ask you the value of each of these installation options.
You may simply press the Enter key to leave unchanged.
Default host triple? [x86_64-pc-windows-msvc]
x86_64-pc-windows-gnu
Default toolchain? (stable/beta/nightly/none) [stable]
stable
Profile (which tools and data to install)? (minimal/default/complete) [default]
complete
Modify PATH variable? (Y/n)
Y
Current installation options:
default host triple: x86_64-pc-windows-gnu
default toolchain: stable
profile: complete
modify PATH variable: yes
1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
>
再之后,按下 1,等待。完成后,您就已经安装了 Rust 和 rustup。
检查版本
$ rustc -V
rustc 1.56.1 (59eed8a2a 2021-11-01)
$ cargo -V
cargo 1.57.0 (b2e52d7ca 2021-10-21)
卸载
要卸载 Rust 和 rustup,在终端执行以下命令即可卸载:
$ rustup self uninstall
开发
我使用的是clion IDE,按照上述步骤安装好rust gnu后,ide安装rust插件就可以编码调试了
若安装了msvc没有安装gnu使用clion时不进断点,可以使用:
rustup install stable-gnu
rustup default stable-gnu
进行安装gnu,然后就可以正常调试了
如果clion报UTF-8的错误请阅读这个帖子:jetbrains
实在不行用vscode吧🥹🥹🥹
文档资料:Rust圣经