1.
Welcome (欢迎)
1.1.
Syntax (语法)
2.
A Basic Calculator (基础计算器)
2.1.
Integers (整数类型)
2.2.
Variables (变量)
2.3.
Branching: if/else (分支控制:if/else)
2.4.
Panics (恐慌)
2.5.
Factorial (阶乘)
2.6.
Loops: while (循环:while)
2.7.
Loops: for (循环:for)
2.8.
Overflow and underflow (溢出和下溢)
2.9.
Saturating arithmetic (饱和运算)
2.10.
Conversions: as casting (类型转换:as强制转换)
3.
Ticket v1 (工单 v1)
3.1.
Structs (结构体)
3.2.
Validation (验证)
3.3.
Modules (模块)
3.4.
Visibility (可见性)
3.5.
Encapsulation (封装)
3.6.
Ownership (所有权)
3.7.
Setters (设置器)
3.8.
Stack (栈内存)
3.9.
Heap (堆内存)
3.10.
References in memory (内存中的引用)
3.11.
Destructors (析构函数)
3.12.
Outro (结语)
4.
Traits (特质)
4.1.
Trait (特质)
4.2.
Orphan rule (孤儿规则)
4.3.
Operator overloading (运算符重载)
4.4.
Derive macros (派生宏)
4.5.
Trait bounds (特质约束)
4.6.
String slices (字符串切片)
4.7.
Deref trait (Deref 特质)
4.8.
Sized trait (Sized 特质)
4.9.
From trait (From 特质)
4.10.
Associated vs generic types (关联类型 vs 泛型类型)
4.11.
Clone trait (Clone 特质)
4.12.
Copy trait (Copy 特质)
4.13.
Drop trait (Drop 特质)
4.14.
Outro (结语)
5.
Ticket v2 (工单 v2)
5.1.
Enums (枚举)
5.2.
Branching: match (分支控制:match)
5.3.
Variants with data (带数据的枚举变体)
5.4.
Branching: if let and let/else (分支控制:if let 和 let/else)
5.5.
Nullability (空值处理)
5.6.
Fallibility (可失败性)
5.7.
Unwrap (解包)
5.8.
Error enums (错误枚举)
5.9.
Error trait (Error 特质)
5.10.
Packages (包)
5.11.
Dependencies (依赖)
5.12.
thiserror (thiserror 库)
5.13.
TryFrom trait (TryFrom 特质)
5.14.
Error::source (Error::source)
5.15.
Outro (结语)
6.
Ticket Management (工单管理)
6.1.
Arrays (数组)
6.2.
Vectors (向量)
6.3.
Resizing (调整大小)
6.4.
Iterators (迭代器)
6.5.
Iter (迭代)
6.6.
Lifetimes (生命周期)
6.7.
Combinators (组合器)
6.8.
impl Trait (impl Trait)
6.9.
impl Trait, pt.2 (impl Trait 第二部分)
6.10.
Slices (切片)
6.11.
Mutable slices (可变切片)
6.12.
Two states (双状态)
6.13.
Index trait (Index 特质)
6.14.
IndexMut trait (IndexMut 特质)
6.15.
HashMap (哈希映射)
6.16.
BTreeMap (B-树映射)
7.
Threads (线程)
7.1.
Threads (线程)
7.2.
'static lifetime ('static 生命周期)
7.3.
Leaking memory (内存泄漏)
7.4.
Scoped threads (作用域线程)
7.5.
Channels (通道)
7.6.
Interior mutability (内部可变性)
7.7.
Ack pattern (确认模式)
7.8.
Client (客户端)
7.9.
Bounded channels (有界通道)
7.10.
Patching (修补)
7.11.
Mutex, Send and Arc (互斥锁、Send 和 Arc)
7.12.
RwLock (读写锁)
7.13.
Without channels (无通道)
7.14.
Sync trait (Sync 特质)
8.
Futures (Future)
8.1.
Asynchronous functions (异步函数)
8.2.
Spawning tasks (生成任务)
8.3.
Runtime (运行时)
8.4.
Future trait (Future 特质)
8.5.
Blocking the runtime (阻塞运行时)
8.6.
Async-aware primitives (异步感知原语)
8.7.
Cancellation (取消操作)
8.8.
Outro (结语)
9.
Going further (进阶内容)
Light
Rust
Coal
Navy
Ayu
100 Exercises To Learn Rust
阶乘 (Factorial)
到目前为止,你已经学习了:
如何定义函数 (function)
如何调用函数
Rust 中可用的整数类型
整数可用的算术运算符
如何通过比较和
if
/
else
表达式执行条件逻辑
看起来你已经准备好处理阶乘了!
原文链接:
英文原文