Rust开发环境搭建

Rust开发环境搭建

环境

rust: 1.79.0(2024-06-13)

1. Rustup下载器在线安装

windows:

https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe

unix:

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

2. Rust独立安装包离线安装

windows:

https://static.rust-lang.org/dist/rust-1.79.0-x86_64-pc-windows-msvc.msi

linux:

https://static.rust-lang.org/dist/rust-1.79.0-x86_64-unknown-linux-gnu.tar.xz

macos:

https://static.rust-lang.org/dist/rust-1.79.0-x86_64-apple-darwin.pkg

3. Rust命令行

  • 查看rust版本
$ rustc -V
rustc 1.79.0
  • 新建rust项目
cargo new hello_world
  • cargo编译rust项目
$ cargo build
  • rustc编译rust项目
$ rustc src/main.rs
  • 运行rust程序
$ ./target/debug/hello_world
Hello, world!

4. IDE集成开发环境

4.1 VSCode

Rust with Visual Studio Code

4.2 vs2022

[User Manual (rust-analyzer.github.io)

5. 使用镜像加速cargo

$CARGO_HOME/config中加入如下内容

[source.crates-io]
replace-with = 'mirror'

[source.mirror]
registry = "https://mirrors.tuna.tsinghua.edu.cn/git/crates.io-index.git"

注:$CARGO_HOME:在 Windows 系统默认为:%USERPROFILE%\.cargo,在类 Unix 系统默认为:$HOME/.cargo


Reference:

  1. Other Installation Methods - Rust Forge (rust-lang.org)

相关推荐

  1. Rust开发环境

    2024-07-11 21:38:01       24 阅读
  2. Rust介绍与开发环境

    2024-07-11 21:38:01       59 阅读
  3. Linux下超轻量级Rust开发环境:一、安装Rust

    2024-07-11 21:38:01       54 阅读
  4. golang开发环境

    2024-07-11 21:38:01       62 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-11 21:38:01       66 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-11 21:38:01       70 阅读
  3. 在Django里面运行非项目文件

    2024-07-11 21:38:01       57 阅读
  4. Python语言-面向对象

    2024-07-11 21:38:01       68 阅读

热门阅读

  1. E10.【C语言】练习:编写一个猜数字游戏

    2024-07-11 21:38:01       19 阅读
  2. k8s 容器环境下的镜像如何转换为docker 使用

    2024-07-11 21:38:01       26 阅读
  3. 使用Apache Beam进行统一批处理与流处理

    2024-07-11 21:38:01       23 阅读
  4. 【LinuxC语言】手撕Http之处理POST请求

    2024-07-11 21:38:01       21 阅读
  5. 常用的简单的ps快捷键

    2024-07-11 21:38:01       19 阅读
  6. Bug汇总

    2024-07-11 21:38:01       20 阅读
  7. LVS集群(二)

    2024-07-11 21:38:01       22 阅读
  8. vscode连接unbuntu失败,显示Downloading vs code server...

    2024-07-11 21:38:01       19 阅读
  9. Memcached介绍和详解

    2024-07-11 21:38:01       20 阅读
  10. Qt常用基础控件总结—表格控件(QTableWidget类)

    2024-07-11 21:38:01       22 阅读
  11. pudb: Python的图形化调试器

    2024-07-11 21:38:01       24 阅读