Rust 基础大纲

Rust 基础大纲

1.Summary

安装

https://www.rust-lang.org/zh-CN/tools/install

bash 复制代码
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# 安装完成后,验证是否成功
rustc -V
cargo -V

# 创建项目
cargo new my_project
# 编译项目
cargo build
# 生成的可执行文件位于 target/debug/ 目录下。

# 运行程序
# 直接运行以下命令:
cargo run

教材

https://practice.rs/
rust by examples

https://doc.rust-lang.org/stable/rust-by-example/
rust 圣经

https://course.rs/about-book.html
rust 官方文档中文网站

https://rustwiki.org/
Experiment: Improving the Rust Book

https://rust-book.cs.brown.edu/

2 Rust 源

中国区,可能连接 crates.io 会有问题。

$HOME/.cargo/config 中添加如下内容:

bash 复制代码
[source.crates-io]
replace-with = 'ustc'

[source.ustc]
registry = "git://mirrors.ustc.edu.cn/crates.io-index"

如果所处的环境中不允许使用 git 协议,可以把上述地址改为:

bash 复制代码
registry = "https://mirrors.ustc.edu.cn/crates.io-index"

2.1 cargo 版本>= 1.68 支持稀疏索引

可以在 $HOME/.cargo/config 中添加如下内容:
cargo 1.68 版本开始支持稀疏索引:不再需要完整克隆 crates.io-index 仓库,可以加快获取包的速度。

bash 复制代码
[source.crates-io]
replace-with = 'ustc'

[source.ustc]
registry = "sparse+https://mirrors.ustc.edu.cn/crates.io-index/"
相关推荐
hsg775 小时前
简述:Rust、GeoRust、自主研发GIS平台
开发语言·后端·rust
AOwhisky15 小时前
下一代容器来了?Docker 宣布原生支持 WebAssembly
java·运维·docker·容器·rust·wasm
铅笔侠_小龙虾21 小时前
Rust 学习(6)-所有权规则、移动语义、Clone 与 Copy
python·学习·rust
程序员爱钓鱼1 天前
Rust 控制流 if 详解:条件判断与 if 表达式
前端·后端·rust
花褪残红青杏小2 天前
Rust图像处理第19节-RGB 色彩矩阵变换:矩阵 × 向量 = 像素变换
rust·webassembly·图形学
white_ant2 天前
15-ASCII 转换工具使用指南
rust·tauri·watools
铅笔侠_小龙虾2 天前
Rust 学习(2)-变量、常量与 shadowing
学习·算法·rust
独孤留白2 天前
从C到Rust:Mutex / RwLock / Atomic 跨线程局部可变性
rust
程序员爱钓鱼2 天前
Rust 注释与文档注释详解:从代码说明到 cargo doc
后端·rust
花褪残红青杏小3 天前
Rust图像处理第18节-分形画布缩放 + 拖拽交互:图像缩放 + f32 性能优化
rust·webassembly·图形学