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/"
相关推荐
Source.Liu3 小时前
【BuildFlow & 筑流】品牌命名与项目定位说明
c++·qt·rust·markdown·librecad
ftpeak4 小时前
《Cargo 参考手册》第二十二章:发布命令
开发语言·rust
JoannaJuanCV2 天前
error: can‘t find Rust compiler
开发语言·后端·rust
Kiri霧2 天前
在actix-web应用用构建集成测试
后端·rust·集成测试
muyouking113 天前
Tauri Android 开发踩坑实录:从 Gradle 版本冲突到离线构建成功
android·rust
Kiri霧3 天前
Rust开发环境搭建
开发语言·后端·rust
xuejianxinokok3 天前
什么是代数类型 ? java为什么要添加record,Sealed class 和增强switch ?
后端·rust
Kiri霧3 天前
在actix-web中创建一个提取器
后端·rust·web
^_^ 纵歌3 天前
rust主要用于哪些领域
开发语言·后端·rust
l1t4 天前
测试DuckDB电子表格读取插件rusty_sheet 0.2版
数据库·rust·插件·xlsx·duckdb