📄️ Chapter1 Getting started
In this chapter, we'll discuss:
📄️ The Rust Programming Language
The rust programming language can help us write faster, more reliable software.
📄️ Chapter2 Guessing Game
This chapter introduces you to a few common Rust concepts by showing you how to use them in real program.
📄️ Chapter3 Common Programming Concepts
Variables and Mutability
📄️ Chapter4 Ownership
在 Rust 中, 非常独特的一个特性就是 Ownership. 正时 Ownership 机制保证了 Rust 在没有 GC 的情况下也可以做到内存安全. 因此学习 Rust 必须理解 Rust 的 Ownership 机制.
📄️ C5 Struct 的使用
Struct 主要就是语法上的内容, 列于如下:
📄️ Enum 和模式匹配
enum 的简单用法是:
📄️ Rust 工程化
本章主要包括:
📄️ 常用集合类型
Rust 标准库中包含许多集合数据类型方便使用. 这些集合都是在堆上分配内存的, 这些集合类型如下:
📄️ 错误处理
错误处理贯穿软件开发的始终, Rust 提供了许多功能帮助在出现错误时进行对应处理.
📄️ 泛型类型, Traits, 生命期
https://doc.rust-lang.org/book/ch10-00-generics.html
📄️ 自动化测试
Rust 中的测试方法为使用 #[test] 标记的函数. 当执行 cargo test 时, Rust 构造一个 test runner 二进制文件来运行这些测试函数.
📄️ 函数式编程: 迭代器和闭包
函数式编程在许多语言中都有, 因此 Rust 也借鉴了许多函数式编程的相关技术. 函数式编程中通常都将函数作为参数/返回值, 或将函数作为变量在之后执行等.