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/"
相关推荐
lpfasd12310 小时前
鸿蒙OS与Rust整合开发流程
华为·rust·harmonyos
m0_480502641 天前
Rust 登堂 之 类型转换(三)
开发语言·后端·rust
ftpeak2 天前
Rust Web开发指南 第六章(动态网页模板技术-MiniJinja速成教程)
开发语言·前端·后端·rust·web
编码浪子2 天前
趣味学Rust基础篇(数据类型)
开发语言·后端·rust
编码浪子2 天前
趣味学习Rust基础篇(用Rust做一个猜数字游戏)
学习·rust
love530love2 天前
怎么更新 cargo.exe ?(Rust 工具链)
人工智能·windows·python·rust·r语言
Source.Liu3 天前
【typenum】 23 倒序存储的无符号整数(private.rs片段)
rust
咸甜适中3 天前
rust语言(1.88.0)sqlite数据库rusqlite库(0.37.0)学习笔记
数据库·rust·sqlite·rusqlite
jinlei20093 天前
在python 代码中调用rust 源码库操作步骤
开发语言·python·rust
m0_480502643 天前
Rust 登堂 之 函数式编程(三)
开发语言·后端·rust