- 前言
- 第一部
- 1. 基礎
- 1.1. 安裝 Rust
- 1.2. 第一個程式
- 1.3. 變數與輸出
- 1.4. 註解
- 1.5. 算術運算子
- 1.6. 運算子優先順序
- 1.7. 比較運算子
- 1.8. if
- 1.9. 作用域
- 1.10. else
- 1.11. else if
- 1.12. 邏輯運算子
- 1.13. let mut
- 1.14. 複合賦值運算子
- 1.15. stdin
- 1.16. parse
- 1.17. 綜合練習
- 1.18. loop + break
- 1.19. while
- 1.20. for + range
- 1.21. 巢狀迴圈
- 1.22. continue
- 1.23. 型別(基礎)
- 1.24. 型別(數字詳解)
- 1.25. char
- 1.26. 跳脫字元
- 1.27. if 當表達式
- 2. 函數、陣列與切片
- 2.1. const
- 2.2. shadowing
- 2.3. 底線變數
- 2.4. tuple
- 2.5. {:?} Debug 格式
- 2.6. 簡單函數
- 2.7. 函數參數
- 2.8. 函數回傳值
- 2.9. early return
- 2.10. 遞迴
- 2.11. 陣列基礎
- 2.12. 陣列走訪
- 2.13. 切片 &[T]
- 2.14. 切片作為參數
- 2.15. 字串切片 &str
- 3. Struct、Enum 與 Pattern Matching
- 3.1. struct(named fields)
- 3.2. tuple struct 與 unit struct
- 3.3. enum(C-style)
- 3.4. match C-style enum
- 3.5. match 當表達式
- 3.6. block 表達式
- 3.7. enum 攜帶 tuple variant
- 3.8. enum 攜帶 struct variant
- 3.9. match 解構 tuple variant
- 3.10. match 解構 struct variant
- 3.11. field shorthand
- 3.12. tuple pattern
- 3.13. slice pattern
- 3.14. 巢狀 pattern matching
- 3.15. _ wildcard
- 3.16. .. 忽略多個值
- 3.17. range pattern
- 3.18. 多個值 |
- 3.19. @ 綁定
- 3.20. match guard
- 3.21. let 解構 tuple
- 3.22. let 解構 struct
- 3.23. for 迴圈解構
- 3.24. 函數參數解構
- 3.25. if let
- 3.26. while let
- 3.27. let else
- 3.28. associated function
- 3.29. method
- 3.30. 大寫 Self
- 4. 所有權與借用
- 4.1. 所有權(鑰匙圈比喻)
- 4.2. trait 簡介
- 4.3. move 與 Clone
- 4.4. Copy
- 4.5. 借用 &
- 4.6. 可變借用 &mut
- 4.7. 借用規則
- 4.8. self vs &self vs &mut self
- 4.9. stack 與 heap
- 4.10. String
- 4.11. String vs &str
- 4.12. Vec 基礎
- 4.13. Vec 與所有權
- 5. 泛型、Trait Bound 與生命週期
- 5.1. 泛型函數
- 5.2. 泛型 struct
- 5.3. 泛型 enum
- 5.4. turbofish 語法
- 5.5. placeholder type _
- 5.6. 型別別名
- 5.7. 泛型 impl
- 5.8. Option<T>
- 5.9. Option 常用方法
- 5.10. Result<T, E>
- 5.11. ? 運算子
- 5.12. 多個方法的 trait 與預設實作
- 5.13. trait bound
- 5.14. use 基礎
- 5.15. Display trait
- 5.16. 多個 trait bound 與 where
- 5.17. impl Trait 語法
- 5.18. 多參數 trait
- 5.19. From<T> / Into<T>
- 5.20. Drop
- 5.21. Box<T>
- 5.22. Rc<T>
- 5.23. Deref
- 5.24. Cell<T>
- 5.25. RefCell<T>
- 5.26. 生命週期基礎
- 5.27. 生命週期省略規則
- 5.28. 型別上的生命週期
- 5.29. lifetime bound
- 5.30. supertrait
- 5.31. 常見的 derive trait
- 5.32. associated type
- 5.33. Cow<'a, B>
- 6. 閉包與迭代器
- 6.1. 函數指標
- 6.2. 閉包用法展示
- 6.3. 手動實作閉包
- 6.4. 閉包種類的推斷
- 6.5. FnOnce / FnMut / Fn
- 6.6. move 閉包
- 6.7. Option / Result 的閉包方法
- 6.8. Iterator trait
- 6.9. for 迴圈的真面目
- 6.10. into_iter / iter_mut / iter
- 6.11. 收集
- 6.12. 聚合
- 6.13. 組合與截取
- 6.14. 轉換與過濾
- 6.15. 惰性求值
- 7. Cargo、Crate 與 Mod 系統
- 7.1. Cargo 與 crates.io
- 7.2. mod
- 7.3. 檔案 mod
- 7.4. pub 可見性
- 7.5. use
- 7.6. cargo test
- 7.7. pub use
- 7.8. orphan rule
- 7.9. 文件註解
- 7.10. cargo publish
- 8. 附錄一
- 8.1. 數字字面值格式
- 8.2. && 和 || 的短路行為
- 8.3. break 回傳值
- 8.4. 多行字串 & raw string literal
- 8.5. 格式化字串進階
- 8.6. struct / enum 放在 fn 裡面
- 8.7. struct update syntax
- 8.8. ref pattern 與 match ergonomics
- 8.9. panic! / todo! / unimplemented! / unreachable!
- 8.10. let chains
- 8.11. Rc 迴圈與 Weak
- 8.12. fully qualified syntax
- 8.13. DST 簡介
- 8.14. extern crate
- 第二部
- 9. 多執行緒
- 9.1. 指標
- 9.2. thread::spawn
- 9.3. Send / Sync
- 9.4. RefCell 在多執行緒
- 9.5. Rc 在多執行緒
- 9.6. Arc<T>
- 9.7. atomic 型別
- 9.8. Mutex<T>
- 9.9. RwLock<T>
- 9.10. poisoning
- 9.11. mpsc
- 9.12. 死鎖
- 9.13. thread::scope 簡介
- 10. 進階語言功能
- 10.1. dyn Trait 基礎
- 10.2. dyn compatibility
- 10.3. const fn
- 10.4. associated const
- 10.5. const generics
- 10.6. 預設參數
- 10.7. 運算子重載
- 10.8. 型別轉換 as
- 10.9. enum discriminant
- 10.10. attribute 總覽
- 10.11. cfg! 巨集
- 10.12. macro_rules!
- 10.13. proc macro
- 10.14. unsafe
- 10.15. static 變數
- 10.16. LazyLock
- 10.17. extern blocks
- 10.18. union
- 10.19. never type !
- 11. 進階標準庫
- 11.1. AsRef<T> / AsMut<T>
- 11.2. Ordering 與排序
- 11.3. HashMap<K, V>
- 11.4. HashSet<T>
- 11.5. 其他集合簡介
- 11.6. std::env / std::process
- 11.7. std::path
- 11.8. 字串方法
- 11.9. I/O:stdin、檔案讀寫
- 11.10. Error trait
- 11.11. thiserror / anyhow 簡介
- 11.12. catch_unwind
- 12. 非同步
- 12.1. 第一個 async 程式
- 12.2. 為什麼需要 async
- 12.3. async fn 回傳的是 Future
- 12.4. async 是一種作用
- 12.5. async block
- 12.6. Future trait 與最陽春的 executor
- 12.7. 手寫一個 Delay Future
- 12.8. 用 .await 等待 Delay
- 12.9. 手寫 join
- 12.10. 用 Thread 與 Waker 喚醒 executor
- 12.11. spawn 與 ready queue
- 12.12. spawn 與 JoinHandle
- 12.13. mio
- 12.14. 手寫 reactor
- 12.15. async fn 背後的狀態機
- 12.16. 自我參照的 Future
- 12.17. 為什麼 poll 需要 Pin
- 12.18. Unpin
- 12.19. pin!
- 12.20. async 遞迴
- 12.21. 回到 Tokio
- 12.22. spawn_blocking
- 12.23. join!
- 12.24. Semaphore 與 backpressure
- 12.25. mpsc
- 12.26. oneshot、watch 與 broadcast
- 12.27. AsyncRead 與 AsyncWrite
- 12.28. select!
- 12.29. async 的 Mutex、RwLock 與 Notify
- 12.30. Stream
- 12.31. JoinSet 與 FuturesUnordered
- 12.32. graceful shutdown
- 12.33. 測試 async 程式
- 12.34. Tokio 以外的 runtime
- 13. 附錄二
- 13.1. 'a: 'b
- 13.2. HRTB
- 13.3. variance
- 13.4. PhantomData 與 PhantomPinned
- 13.5. GAT
- 13.6. async 閉包
- 13.7. use bound