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/"
相关推荐
问道飞鱼1 天前
【Tauri框架学习】Tauri 与 React 前端集成:通信机制与交互原理详解
前端·学习·react.js·rust·通信
weixin_387534222 天前
Ownership - Rust Hardcore Head to Toe
开发语言·后端·算法·rust
luffy54592 天前
Rust语言入门-变量篇
开发语言·后端·rust
好家伙VCC2 天前
# 发散创新:用 Rust构建高性能游戏日系统,从零实现事件驱动架构 在现代游戏开发中,**性能与可扩展性**是核心命题。传统基于
java·python·游戏·架构·rust
Source.Liu2 天前
【Iced】transformation.rs文件解析
rust·iced
小杍随笔2 天前
【Rust 语言编程知识与应用:闭包详解】
开发语言·后端·rust
Ivanqhz2 天前
图着色寄存器分配算法(Graph Coloring)
开发语言·javascript·python·算法·蓝桥杯·rust
42tr_k3 天前
Rust LanceDB 内存不足问题
rust
Source.Liu3 天前
【Iced】benches 文件夹分析笔记
rust·iced
Source.Liu3 天前
【glam】线性代数库 lib.rs 文件解析
rust·glam